]>
Commit | Line | Data |
---|---|---|
b9215da1 MT |
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 | |
a61a21ef | 4 | Subject: [PATCH 04/44] x86: Fix incorrect scope of setting `shared_per_thread` |
b9215da1 MT |
5 | [BZ# 30745] |
6 | ||
7 | The: | |
8 | ||
9 | ``` | |
10 | if (shared_per_thread > 0 && threads > 0) | |
11 | shared_per_thread /= threads; | |
12 | ``` | |
13 | ||
14 | Code was accidentally moved to inside the else scope. This doesn't | |
15 | match how it was previously (before af992e7abd). | |
16 | ||
17 | This patch fixes that by putting the division after the `else` block. | |
18 | ||
19 | (cherry picked from commit 084fb31bc2c5f95ae0b9e6df4d3cf0ff43471ede) | |
20 | --- | |
21 | sysdeps/x86/dl-cacheinfo.h | 7 +++---- | |
22 | 1 file changed, 3 insertions(+), 4 deletions(-) | |
23 | ||
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 | |
29 | level. */ | |
30 | threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16) | |
31 | & 0xff); | |
32 | - | |
33 | - /* Get per-thread size of highest level cache. */ | |
34 | - if (shared_per_thread > 0 && threads > 0) | |
35 | - shared_per_thread /= threads; | |
36 | } | |
37 | + /* Get per-thread size of highest level cache. */ | |
38 | + if (shared_per_thread > 0 && threads > 0) | |
39 | + shared_per_thread /= threads; | |
40 | } | |
41 | ||
42 | /* Account for non-inclusive L2 and L3 caches. */ | |
43 | -- | |
44 | 2.39.2 | |
45 |