!123 revert memcpy optimize for kunpeng to avoid performance regression when input large than kbyte.

From: @liqingqing_1229
Reviewed-by: @wswsamao
Signed-off-by: @wswsamao
This commit is contained in:
openeuler-ci-bot 2021-03-01 15:34:43 +08:00 committed by Gitee
commit 08ba759f04
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From 28f2ce27722d890a884cc7fa2f6d2bc0cb418f26 Mon Sep 17 00:00:00 2001
From: Shuo Wang <wangshuo47@huawei.com>
Date: Wed, 20 Jan 2021 15:20:44 +0800
Subject: [PATCH] aarch64: revert memcpy optimze for kunpeng to avoid
performance degradation
In commit 863d775c481704baaa41855fc93e5a1ca2dc6bf6, kunpeng920 is added to default memcpy version,
however, there is performance degradation when the copy size is some large bytes, eg: 100k.
This is the result, tested in glibc-2.28:
before backport after backport Performance improvement
memcpy_1k 0.005 0.005 0.00%
memcpy_10k 0.032 0.029 10.34%
memcpy_100k 0.356 0.429 -17.02%
memcpy_1m 7.470 11.153 -33.02%
This is the demo
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
char a[1024*1024] = {12};
char b[1024*1024] = {13};
int main(int argc, char *argv[])
{
int i = atoi(argv[1]);
int j;
int size = atoi(argv[2]);
for (j = 0; j < i; j++)
memcpy(b, a, size*1024);
return 0;
}
# gcc -g -O0 memcpy.c -o memcpy
# time taskset -c 10 ./memcpy 100000 1024
Co-authored-by: liqingqing <liqingqing3@huawei.com>
---
sysdeps/aarch64/multiarch/memcpy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c
index 27259d3..0e0a5cb 100644
--- a/sysdeps/aarch64/multiarch/memcpy.c
+++ b/sysdeps/aarch64/multiarch/memcpy.c
@@ -37,7 +37,7 @@ extern __typeof (__redirect_memcpy) __memcpy_falkor attribute_hidden;
libc_ifunc (__libc_memcpy,
(IS_THUNDERX (midr)
? __memcpy_thunderx
- : (IS_FALKOR (midr) || IS_PHECDA (midr) || IS_KUNPENG920 (midr)
+ : (IS_FALKOR (midr) || IS_PHECDA (midr)
? __memcpy_falkor
: (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr)
? __memcpy_thunderx2
--
1.8.3.1

View File

@ -59,7 +59,7 @@
##############################################################################
Name: glibc
Version: 2.28
Release: 52
Release: 53
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -108,6 +108,7 @@ 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
Patch35: backport-aarch64-revert-memcpy-optimze-for-kunpeng-to-avoid-p.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -1103,6 +1104,9 @@ fi
%doc hesiod/README.hesiod
%changelog
* Fri Jan 22 2021 Qingqing Li<liqingqing3@huawei.com> - 2.28-53
- revert memcpy optimze for kunpeng to avoid performance regression when input large than kbyte.
* Thu Jan 21 2021 Wang Shuo<wangshuo_1994@foxmail.com> - 2.28-52
- Disable threads in Intel vm environment to avoid performance degradation