From: Yanteng Si <si.yanteng@linux.dev>
To: Wentao Guan <guanwentao@uniontech.com>, chenhuacai@kernel.org
Cc: kernel@xen0n.name, xry111@xry111.site,
linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
zhanjun@uniontech.com
Subject: Re: [PATCH] Loongarch: entry: fix syscall_get_arguments() VS no-bultin-memcpy
Date: Thu, 28 Aug 2025 13:47:01 +0800 [thread overview]
Message-ID: <a0e11216-71b0-447f-beab-351d024810fb@linux.dev> (raw)
In-Reply-To: <20250826113225.406238-1-guanwentao@uniontech.com>
在 8/26/25 7:32 PM, Wentao Guan 写道:
> Loongarch use -fno-builtin-memcpy in Makefile,
> so cause a extra memcpy in syscall hot path:
>
> syscall_enter_audit
> ->syscall_get_arguments->memcpy(__memcpy_fast)
> ->audit_syscall_entry
>
> Just avoid memcpy() altogether and write the copying of args from regs
> manually, which shows 5% multi core score up in UnixBench syscall.
5%? Awesome!
>
> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewed-by: Yanteng Si <siyanteng@cqsoftware.com.cn>
Thanks,
Yanteng
> ---
> arch/loongarch/include/asm/syscall.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/include/asm/syscall.h b/arch/loongarch/include/asm/syscall.h
> index 81d2733f7b94..171af2edd569 100644
> --- a/arch/loongarch/include/asm/syscall.h
> +++ b/arch/loongarch/include/asm/syscall.h
> @@ -65,7 +65,11 @@ static inline void syscall_get_arguments(struct task_struct *task,
> unsigned long *args)
> {
> args[0] = regs->orig_a0;
> - memcpy(&args[1], ®s->regs[5], 5 * sizeof(long));
> + args[1] = regs->regs[5];
> + args[2] = regs->regs[6];
> + args[3] = regs->regs[7];
> + args[4] = regs->regs[8];
> + args[5] = regs->regs[9];
> }
>
> static inline void syscall_set_arguments(struct task_struct *task,
next prev parent reply other threads:[~2025-08-28 5:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 11:32 Wentao Guan
2025-08-28 5:47 ` Yanteng Si [this message]
2025-08-28 6:24 ` Huacai Chen
2025-08-28 6:43 ` Wentao Guan
2025-08-28 6:44 ` Wentao Guan
2025-08-28 6:46 ` Xi Ruoyao
2025-08-28 7:06 ` Wentao Guan
2025-08-28 7:09 ` Huacai Chen
2025-08-28 7:11 ` Xi Ruoyao
2025-08-28 7:14 ` Xi Ruoyao
2025-08-28 17:18 ` Wentao Guan
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=a0e11216-71b0-447f-beab-351d024810fb@linux.dev \
--to=si.yanteng@linux.dev \
--cc=chenhuacai@kernel.org \
--cc=guanwentao@uniontech.com \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=xry111@xry111.site \
--cc=zhanjun@uniontech.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
all inboxes | Powered by JetHome®