]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc-2.38/0004-x86-Fix-incorrect-scope-of-setting-shared_per_thread.patch
glibc: Import latest patches from upstream
[ipfire-2.x.git] / src / patches / glibc-2.38 / 0004-x86-Fix-incorrect-scope-of-setting-shared_per_thread.patch
CommitLineData
b9215da1
MT
1From 5ea70cc02626d9b85f1570153873d8648a47bf95 Mon Sep 17 00:00:00 2001
2From: Noah Goldstein <goldstein.w.n@gmail.com>
3Date: Thu, 10 Aug 2023 19:28:24 -0500
a61a21ef 4Subject: [PATCH 04/44] x86: Fix incorrect scope of setting `shared_per_thread`
b9215da1
MT
5 [BZ# 30745]
6
7The:
8
9```
10 if (shared_per_thread > 0 && threads > 0)
11 shared_per_thread /= threads;
12```
13
14Code was accidentally moved to inside the else scope. This doesn't
15match how it was previously (before af992e7abd).
16
17This 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
24diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
25index 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--
442.39.2
45