News: 0001549655

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux 6.16 Will Be Able To Exit User Mode Faster: 2~11% Improvement

([Linux Kernel] 62 Minutes Ago syscall_exit_user_mode)


While the "core/entry" changes for the Linux kernel merge window aren't typically too exciting to write about, there is a new optimization for all CPU architectures worth mentioning for the Linux 6.16 cycle.

The [1]core/entry pull request was sent out earlier this week and already merged to mainline. For RISC-V and LoongArch it does move some code from Assembly to C and additionally delivering a nice speed boost for ret_from_fork() on RISC-V. But it also contains a generic optimization too as part of these Linux 6.16 changes.

The syscall_exit_user_mode() function is now inlined on Linux 6.16 for all architectures to avoid a function call and letting the compiler carry out better optimizations. The syscall_exit_to_user_mode is for the syscall to exit to user mode preparation.

Charlie Jenkins of Rivos who authored this optimization patch to inline syscall_exit_user_mode noted on the patch message:

"Testing was done with the byte-unixbench syscall benchmark (which calls getpid) and QEMU. On riscv I measured a 7.09246% improvement, on x86 a 2.98843% improvement, on loongarch a 6.07954% improvement, and on s390 a 11.1328% improvement.

The Intel bot also reported kernel test robot noticed a 1.9% improvement of stress-ng.seek.ops_per_sec"

Not bad for a small patch and to just inline the code to better leverage compiler optimizations.

The code is [2]merged and ready for the world in Linux 6.16.



[1] https://lore.kernel.org/lkml/174820637449.238682.15099827741796061971.tglx@xen13/T/#u

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c1494015fea0935fbf6cd9d99c008fcbe1e4165



rene

Hegel was right when he said that we learn from history that man
can never learn anything from history. -George Bernard Shaw