Linux 6.16 Will Be Able To Exit User Mode Faster: 2~11% Improvement
([Linux Kernel] 62 Minutes Ago
syscall_exit_user_mode)
- Reference: 0001549655
- News link: https://www.phoronix.com/news/Linux-616-Faster-Exit-User-Mode
- Source link:
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
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