Skip to content

entry: Move ret_from_fork() to C and inline syscall_exit_to_user_mode()

Charlie Jenkins linux-riscv lkml loongarch 7 versions – Applied

Status from this message: The following commit has been merged into the core/entry branch of tip:

Get series with b4
b4 am [email protected] change-id 20240402-riscv_optimize_entry-583843420325

Versions newest first

  1. v6 Latest4 patches 5 repliesApplied
  2. v54 patches 6 repliesSuperseded
  3. v4 posting 2/24 patches 0 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v4 posting 1/24 patches0 repliesSuperseded
v34 patches0 repliesSuperseded
v24 patches9 repliesSuperseded
v14 patches6 repliesSuperseded

Changes in v6 from the cover letter

- Update commit message of patch 4 to contain performance numbers
- Link to v5: https://lore.kernel.org/r/[email protected]

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/4riscv: entry: Convert ret_from_fork() to Carch/riscv/include/asm/asm-prototypes.h arch/riscv/kernel/entry.S arch/riscv/kernel/process.c+19 -110 replies
2/4riscv: entry: Split ret_from_fork() into user and kernelarch/riscv/include/asm/asm-prototypes.h arch/riscv/kernel/entry.S arch/riscv/kernel/process.c+23 -101 reply
3/4LoongArch: entry: Migrate ret_from_fork() to Carch/loongarch/include/asm/asm-prototypes.h arch/loongarch/kernel/entry.S arch/loongarch/kernel/process.c+45 -181 reply
4/4entry: Inline syscall_exit_to_user_mode()include/linux/entry-common.h kernel/entry/common.c+42 -500 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchAlexandre Ghiti
1/4R-b
2/4A-b
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/4] entry: Move ret_from_fork() to C and inline syscall_exit_to_user_mode()

Similar to commit 221a164035fd ("entry: Move syscall_enter_from_user_mode() to header file"), move syscall_exit_to_user_mode() to the header file as well.

Testing was done with the byte-unixbench [1] 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" [2]

Since this is on QEMU, I know these numbers are not perfect, but they show a trend of general improvement across all architectures that use the generic entry code.

[1] https://github.com/kdlucas/byte-unixbench
[2] https://lore.kernel.org/linux-riscv/[email protected]/

---
Changes in v6:
- Update commit message of patch 4 to contain performance numbers
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Rebase on 6.14-rc5
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- I had messed up warning for ct_state() on rebase, correct that issue
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Fixup comment to properly reflect args (Alex)
- Fix prototypes for loongarch (Huacai)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Fixup compilation issues for loongarch
- Fixup compilation issues with CONFIG_CONTEXT_TRACKING_USER
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Charlie Jenkins (4):
riscv: entry: Convert ret_from_fork() to C
riscv: entry: Split ret_from_fork() into user and kernel
LoongArch: entry: Migrate ret_from_fork() to C
entry: Inline syscall_exit_to_user_mode()

 arch/loongarch/include/asm/asm-prototypes.h |  8 +++++
 arch/loongarch/kernel/entry.S               | 22 ++++++-------
 arch/loongarch/kernel/process.c             | 33 +++++++++++++++----
 arch/riscv/include/asm/asm-prototypes.h     |  2 ++
 arch/riscv/kernel/entry.S                   | 20 +++++++-----
 arch/riscv/kernel/process.c                 | 21 +++++++++++--
 include/linux/entry-common.h                | 43 +++++++++++++++++++++++--
 kernel/entry/common.c                       | 49 +----------------------------
 8 files changed, 119 insertions(+), 79 deletions(-)

---
base-commit: 7eb172143d5508b4da468ed59ee857c6e5e01da6
change-id: 20240402-riscv_optimize_entry-583843420325

Signature · 1 line
- Charlie