From 49c36200bbfbb93a18a23e4dcad80005a71cd9ec Mon Sep 17 00:00:00 2001 From: wangshuo Date: Wed, 20 Jan 2021 15:37:37 +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 f01fff7..c1269bb 100644 --- a/glibc.spec +++ b/glibc.spec @@ -59,7 +59,7 @@ ############################################################################## Name: glibc Version: 2.28 -Release: 50 +Release: 51 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -105,6 +105,7 @@ Patch28: backport-aarch64-fix-stack-missing-after-sp-is-updated.patch Patch29: backport-aarch64-push-the-set-of-rules-before-falling-into-sl.patch Patch30: backport-Fix-buffer-overrun-in-EUC-KR-conversion-module-bz-24.patch Patch31: backport-addmntent-Remove-unbounded-alloca-usage-from-getmnte.patch +Patch32: disable-threads-in-Intel-vm-environment.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1100,6 +1101,9 @@ fi %doc hesiod/README.hesiod %changelog +* Wed Jan 20 2021 Wang Shuo - 2.28-51 +- Disable threads in Intel vm environment to avoid performance degradation. + * Wed Jan 6 2021 Wang Shuo - 2.28-50 - Fix stack missing in _dl_tlsdesc_dynamic Fix buffer overrun in EUC-KR conversion module (bz #24973) -- Gitee