public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/1] arm/syscalls: mark syscall invocation as likely in invoke_syscall
@ 2025-09-19 10:00 Can Peng
  2025-09-19 11:40 ` Will Deacon
  2025-09-22 13:14 ` [PATCH 1/1] arm/syscalls: mark syscall invocation as likely in invoke_syscall Will Deacon
  0 siblings, 2 replies; 4+ messages in thread
From: Can Peng @ 2025-09-19 10:00 UTC (permalink / raw)
  To: catalin.marinas, will; +Cc: linux-arm-kernel, linux-kernel, Can Peng

The invoke_syscall() function is overwhelmingly called for
valid system call entries. Annotate the main path with likely()
to help the compiler generate better branch prediction hints,
reducing CPU pipeline stalls due to mispredictions.

This is a micro-optimization targeting syscall-heavy workloads.

Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
 arch/arm64/kernel/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index c442fcec6b9e..aba7ca6bca2d 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -43,7 +43,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
 
 	add_random_kstack_offset();
 
-	if (scno < sc_nr) {
+	if (likely(scno < sc_nr)) {
 		syscall_fn_t syscall_fn;
 		syscall_fn = syscall_table[array_index_nospec(scno, sc_nr)];
 		ret = __invoke_syscall(regs, syscall_fn);
-- 
2.25.1



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

end of thread, other threads:[~2025-09-22 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 10:00 [PATCH 1/1] arm/syscalls: mark syscall invocation as likely in invoke_syscall Can Peng
2025-09-19 11:40 ` Will Deacon
2025-09-22 12:17   ` [PATCH 1/1] arm/syscalls: mark syscall invocation as Can Peng
2025-09-22 13:14 ` [PATCH 1/1] arm/syscalls: mark syscall invocation as likely in invoke_syscall Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox