1 From 5ea70cc02626d9b85f1570153873d8648a47bf95 Mon Sep 17 00:00:00 2001
2 From: Noah Goldstein <goldstein.w.n@gmail.com>
3 Date: Thu, 10 Aug 2023 19:28:24 -0500
4 Subject: [PATCH 04/27] x86: Fix incorrect scope of setting `shared_per_thread`
10 if (shared_per_thread > 0 && threads > 0)
11 shared_per_thread /= threads;
14 Code was accidentally moved to inside the else scope. This doesn't
15 match how it was previously (before af992e7abd).
17 This patch fixes that by putting the division after the `else` block.
19 (cherry picked from commit 084fb31bc2c5f95ae0b9e6df4d3cf0ff43471ede)
21 sysdeps/x86/dl-cacheinfo.h | 7 +++----
22 1 file changed, 3 insertions(+), 4 deletions(-)
24 diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
25 index 285773039f..5ddb35c9d9 100644
26 --- a/sysdeps/x86/dl-cacheinfo.h
27 +++ b/sysdeps/x86/dl-cacheinfo.h
28 @@ -770,11 +770,10 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
30 threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16)
33 - /* Get per-thread size of highest level cache. */
34 - if (shared_per_thread > 0 && threads > 0)
35 - shared_per_thread /= threads;
37 + /* Get per-thread size of highest level cache. */
38 + if (shared_per_thread > 0 && threads > 0)
39 + shared_per_thread /= threads;
42 /* Account for non-inclusive L2 and L3 caches. */