Skip to content

riscv/mm/fault: Page fault handler cleanups

Pekka Enberg linux-riscv 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8riscv/mm/fault: Move no context handling to no_context()arch/riscv/mm/fault.c+52 -310 replies
2/8riscv/mm/fault: Move bad area handling to bad_area()arch/riscv/mm/fault.c+40 -270 replies
3/8riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault()arch/riscv/mm/fault.c+82 -820 replies
4/8riscv/mm/fault: Simplify fault error handlingarch/riscv/mm/fault.c+8 -100 replies
5/8riscv/mm/fault: Move fault error handling to mm_fault_error()arch/riscv/mm/fault.c+31 -250 replies
6/8riscv/mm/fault: Simplify mm_fault_error()arch/riscv/mm/fault.c+18 -230 replies
7/8riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault()arch/riscv/mm/fault.c+3 -10 replies
8/8riscv/mm/fault: Move access error check to functionarch/riscv/mm/fault.c+27 -210 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] riscv/mm/fault: Page fault handler cleanups

From: Pekka Enberg <[email protected]>

This patch series cleans up the do_page_fault() function by replacing gotos with function calls, similar to what the x86 architecture does. The motivation for this series is to make thepage fault handling code easier to read and reason about.

The use of gotos has no advantage in kernel code size either. In fact, the bloatometer script shows a tiny decrease in kernel text size:

add/remove: 1/0 grow/shrink: 0/2 up/down: 96/-99 (-3)
Function old new delta
no_context.part - 96 +96
__func__ 14 13 -1
do_page_fault 778 680 -98
Total: Before=792, After=789, chg -0.38%

Please note tht x86 also moves these functions out-of-line with the "noinline" annotation, which supposedly decreases stack usage in do_page_fault() at the expense of slighly larger kernel code size.

However, in my testing, I was able to reduce stack usage at maximum by 16 bytes, at the expense of much larger kernel code size, so I am keeping the functions inline, and letting the compiler do its job.

The patch series has been tested on QEMU.

You can pull the series from:

[email protected]:penberg/linux.git penberg/riscv/mm-fault-cleanups

Pekka Enberg (8):
riscv/mm/fault: Move no context handling to no_context() riscv/mm/fault: Move bad area handling to bad_area() riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault() riscv/mm/fault: Simplify fault error handling riscv/mm/fault: Move fault error handling to mm_fault_error() riscv/mm/fault: Simplify mm_fault_error() riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault() riscv/mm/fault: Move access error check to function

 arch/riscv/mm/fault.c | 337 +++++++++++++++++++++++-------------------
 1 file changed, 189 insertions(+), 148 deletions(-)
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv