From 01a269deb7a5701256ad8322d9902641ea4991ae Mon Sep 17 00:00:00 2001 From: wangshuo Date: Thu, 21 Jan 2021 11:27:44 +0800 Subject: [PATCH] Disable threads on Intel vm environment to avoid performance degradation --- disable-threads-in-Intel-vm-environment.patch | 41 +++++++++++++++++++ glibc.spec | 6 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 disable-threads-in-Intel-vm-environment.patch diff --git a/disable-threads-in-Intel-vm-environment.patch b/disable-threads-in-Intel-vm-environment.patch new file mode 100644 index 0000000..9e77a55 --- /dev/null +++ b/disable-threads-in-Intel-vm-environment.patch @@ -0,0 +1,41 @@ +From 22e7ec9550f78af6154e22369cdcd048ba055b23 Mon Sep 17 00:00:00 2001 +From: Shuo Wang +Date: Mon, 11 Jan 2021 21:21:28 +0800 +Subject: [PATCH] disable threads on Intel vm environment + +Disable threads on Intel vm environment to avoid performance degradation, eg: 1k. + +__x86_shared_non_temporal_threshold is used to determine whether to use L3 cache, +which is calculated by the variable threads when environment variable is not set. +When the memcpy size exceeds __x86_shared_non_temporal_threshold, L3 cache is not +employed to avoid blowing away the entire cache contents for such large copies, +negatively impacting whole system performance. +https://sourceware.org/pipermail/libc-alpha/2021-January/121510.html + +The glibc community have removed threads from threashold calculation formula in +commit d3c57027470b78dba79c6d931e4e409b1fecfc80, which, however, results in +performance degradation on host environment when copying large size, even if the +performance of vm environment has restored. + +In such case, we only align with the community when calculating thresholds on +vm environment. +--- + sysdeps/x86/cacheinfo.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c +index b9444ddd..7615334e 100644 +--- a/sysdeps/x86/cacheinfo.c ++++ b/sysdeps/x86/cacheinfo.c +@@ -691,6 +691,8 @@ intel_bug_no_cache_info: + if (shared > 0 && threads > 0) + shared /= threads; + } ++ else ++ threads = 1; + + /* Account for non-inclusive L2 and L3 caches. */ + if (!inclusive_cache) +-- +2.23.0 + diff --git a/glibc.spec b/glibc.spec index 9204a74..25fbf2b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -59,7 +59,7 @@ ############################################################################## Name: glibc Version: 2.28 -Release: 51 +Release: 52 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -107,6 +107,7 @@ Patch30: backport-Fix-buffer-overrun-in-EUC-KR-conversion-module-bz-24.patch Patch31: backport-addmntent-Remove-unbounded-alloca-usage-from-getmnte.patch Patch32: backport-Use-O_CLOEXEC-in-sysconf-BZ-26791.patch Patch33: backport-aarch64-Add-unwind-information-to-_start-bug-26853.patch +Patch34: disable-threads-in-Intel-vm-environment.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1102,6 +1103,9 @@ fi %doc hesiod/README.hesiod %changelog +* Thu Jan 21 2021 Wang Shuo - 2.28-52 +- Disable threads in Intel vm environment to avoid performance degradation + * Thu Jan 7 2021 Qingqing Li - 2.28-51 - Fix bug 26791: Use O_CLOEXEC in sysconf bugzilla link: https://sourceware.org/bugzilla/show_bug.cgi?id=26791 -- Gitee