Disable threads on Intel vm environment to avoid performance degradation

This commit is contained in:
wangshuo 2021-01-21 11:27:44 +08:00 committed by liqingqing_1229
parent de13ce57a0
commit 027cbf017e
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 22e7ec9550f78af6154e22369cdcd048ba055b23 Mon Sep 17 00:00:00 2001
From: Shuo Wang <wangshuo_1994@foxmail.com>
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

View File

@ -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<wangshuo_1994@foxmail.com> - 2.28-52
- Disable threads in Intel vm environment to avoid performance degradation
* Thu Jan 7 2021 Qingqing Li<liqingqing3@huawei.com> - 2.28-51
- Fix bug 26791: Use O_CLOEXEC in sysconf
bugzilla link: https://sourceware.org/bugzilla/show_bug.cgi?id=26791