[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H7zKLNpx7jM=JBT7unqQ=G4Ztv4RgEhrFsjP+P4LjPYjA@mail.gmail.com>
Date: Thu, 28 Aug 2025 14:24:18 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Yanteng Si <si.yanteng@...ux.dev>
Cc: Wentao Guan <guanwentao@...ontech.com>, kernel@...0n.name, xry111@...111.site,
linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
zhanjun@...ontech.com
Subject: Re: [PATCH] Loongarch: entry: fix syscall_get_arguments() VS no-bultin-memcpy
On Thu, Aug 28, 2025 at 1:47 PM Yanteng Si <si.yanteng@...ux.dev> wrote:
>
> 在 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@...ontech.com>
> Reviewed-by: Yanteng Si <siyanteng@...oftware.com.cn>
But why this is a "fix"? It is an optimization.
Huacai
>
> 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,
>
Powered by blists - more mailing lists