linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Loongarch: entry: fix syscall_get_arguments() VS no-bultin-memcpy
@ 2025-08-26 11:32 Wentao Guan
  2025-08-28  5:47 ` Yanteng Si
  2025-08-28  6:46 ` Xi Ruoyao
  0 siblings, 2 replies; 11+ messages in thread
From: Wentao Guan @ 2025-08-26 11:32 UTC (permalink / raw)
  To: chenhuacai; +Cc: kernel, xry111, linux-kernel, loongarch, zhanjun, 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.

Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
 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], &regs->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,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-08-28 17:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 11:32 [PATCH] Loongarch: entry: fix syscall_get_arguments() VS no-bultin-memcpy Wentao Guan
2025-08-28  5:47 ` Yanteng Si
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

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 NNTP newsgroup(s).