public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Shuo Wang <wangshuo47@huawei.com>
To: <adhemerval.zanella@linaro.org>, <zhangxuelei4@huawei.com>,
	<libc-alpha@sourceware.org>
Cc: <hushiyuan@huawei.com>, <liqingqing3@huawei.com>
Subject: [PATCH] aarch64: revert memcpy optimze for kunpeng to avoid performance degradation
Date: Wed, 20 Jan 2021 15:20:44 +0800	[thread overview]
Message-ID: <20210120072044.23228-1-wangshuo47@huawei.com> (raw)

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 27259d3386..0e0a5cbcfb 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
-- 
2.23.0


             reply	other threads:[~2021-01-20  7:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  7:20 Shuo Wang [this message]
2021-01-20 13:09 ` Adhemerval Zanella
2021-01-20  9:34 Shuo Wang
2021-01-20  9:35 Shuo Wang
2021-01-20 14:49 Wilco Dijkstra
2021-01-21  1:55 Zhangxuelei (Derek)
2021-01-21 16:41 ` Adhemerval Zanella
2021-01-21 16:45   ` Szabolcs Nagy
2021-01-22  1:26 Shuo Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210120072044.23228-1-wangshuo47@huawei.com \
    --to=wangshuo47@huawei.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=hushiyuan@huawei.com \
    --cc=libc-alpha@sourceware.org \
    --cc=liqingqing3@huawei.com \
    --cc=zhangxuelei4@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).