aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2023-08-11 18:37:39 -0500
committerNoah Goldstein <goldstein.w.n@gmail.com>2023-09-11 22:47:26 -0500
commit05c28930951588234226567227350c2339844f3d (patch)
tree2d2ab1224b651b54693f5fc955b2dbd88e4dec3d /sysdeps
parentb462b80b08c4e15f0afe3f0ff3507abd6ff8ef3a (diff)
downloadglibc-05c28930951588234226567227350c2339844f3d.zip
glibc-05c28930951588234226567227350c2339844f3d.tar.gz
glibc-05c28930951588234226567227350c2339844f3d.tar.bz2
x86: Fix slight bug in `shared_per_thread` cache size calculation.
After: ``` commit af992e7abdc9049714da76cae1e5e18bc4838fb8 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Wed Jun 7 13:18:01 2023 -0500 x86: Increase `non_temporal_threshold` to roughly `sizeof_L3 / 4` ``` Split `shared` (cumulative cache size) from `shared_per_thread` (cache size per socket), the `shared_per_thread` *can* be slightly off from the previous calculation. Previously we added `core` even if `threads_l2` was invalid, and only used `threads_l2` to divide `core` if it was present. The changed version only included `core` if `threads_l2` was valid. This change restores the old behavior if `threads_l2` is invalid by adding the entire value of `core`. Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit 47f747217811db35854ea06741be3685e8bbd44d)
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86/cacheinfo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index ef88b6a..47a2487 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -747,8 +747,8 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
/* Account for non-inclusive L2 and L3 caches. */
if (!inclusive_cache)
{
- if (threads_l2 > 0)
- shared_per_thread += core / threads_l2;
+ long int core_per_thread = threads_l2 > 0 ? (core / threads_l2) : core;
+ shared_per_thread += core_per_thread;
shared += core;
}