Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] riscv/mm/fault: Page fault handler cleanups
@ 2020-08-25 18:38 Pekka Enberg
  2020-08-25 18:39 ` [PATCH 1/8] riscv/mm/fault: Move no context handling to no_context() Pekka Enberg
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Pekka Enberg @ 2020-08-25 18:38 UTC (permalink / raw)
  To: linux-riscv; +Cc: Pekka Enberg, palmer

From: Pekka Enberg <penberg@kernel.org>

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:

  git@github.com: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(-)

-- 
2.26.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2020-09-04 19:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-25 18:38 [PATCH 0/8] riscv/mm/fault: Page fault handler cleanups Pekka Enberg
2020-08-25 18:39 ` [PATCH 1/8] riscv/mm/fault: Move no context handling to no_context() Pekka Enberg
2020-08-25 18:39 ` [PATCH 2/8] riscv/mm/fault: Move bad area handling to bad_area() Pekka Enberg
2020-08-25 18:39 ` [PATCH 3/8] riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault() Pekka Enberg
2020-08-25 18:39 ` [PATCH 4/8] riscv/mm/fault: Simplify fault error handling Pekka Enberg
2020-08-25 18:39 ` [PATCH 5/8] riscv/mm/fault: Move fault error handling to mm_fault_error() Pekka Enberg
2020-08-25 18:39 ` [PATCH 6/8] riscv/mm/fault: Simplify mm_fault_error() Pekka Enberg
2020-08-25 18:39 ` [PATCH 7/8] riscv/mm/fault: Move FAULT_FLAG_WRITE handling in do_page_fault() Pekka Enberg
2020-08-25 18:39 ` [PATCH 8/8] riscv/mm/fault: Move access error check to function Pekka Enberg
2020-08-25 19:08 ` [PATCH 0/8] riscv/mm/fault: Page fault handler cleanups Pekka Enberg
2020-09-04 17:37 ` Palmer Dabbelt

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