Fix string and memory function tuning on small systems (#2180462)

Related: #2180462
This commit is contained in:
Carlos O'Donell 2023-08-15 12:07:04 -04:00
parent f089a914cf
commit 653ef302d2
2 changed files with 44 additions and 1 deletions

39
glibc-rh2180462-4.patch Normal file
View File

@ -0,0 +1,39 @@
Adjusted for backport to c8s by modifying sysdeps/x86/cacheinfo.h.
commit 885a7f0feee951f514a121788f46f33b2867110f
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date: Fri Aug 11 12:29:11 2023 -0500
x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745]
The:
```
if (shared_per_thread > 0 && threads > 0)
shared_per_thread /= threads;
```
Code was accidentally moved to inside the else scope. This doesn't
match how it was previously (before af992e7abd).
This patch fixes that by putting the division after the `else` block.
diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
index 4dbfa979ef052eaa..e53fa25106c95253 100644
--- a/sysdeps/x86/cacheinfo.h
+++ b/sysdeps/x86/cacheinfo.h
@@ -243,11 +243,10 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u
level. */
threads = ((cpu_features->features[COMMON_CPUID_INDEX_1].cpuid.ebx >> 16)
& 0xff);
-
- /* Get per-thread size of highest level cache. */
- if (shared_per_thread > 0 && threads > 0)
- shared_per_thread /= threads;
}
+ /* Get per-thread size of highest level cache. */
+ if (shared_per_thread > 0 && threads > 0)
+ shared_per_thread /= threads;
}
/* Account for non-inclusive L2 and L3 caches. */

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.28
%define glibcversion 2.28
%define glibcrelease 235%{?dist}
%define glibcrelease 236%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -1046,6 +1046,7 @@ Patch853: glibc-rh2176707-3.patch
Patch854: glibc-rh2180462-1.patch
Patch855: glibc-rh2180462-2.patch
Patch856: glibc-rh2180462-3.patch
Patch857: glibc-rh2180462-4.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2876,6 +2877,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Tue Aug 15 2023 Carlos O'Donell <carlos@redhat.com> - 2.28-236
- Fix string and memory function tuning on small systems (#2180462)
* Tue Aug 8 2023 DJ Delorie <dj@redhat.com> - 2.28-235
- Fix temporal threshold calculations (#2180462)