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

Pekka Enberg penberg at gmail.com
Tue Aug 25 15:08:50 EDT 2020


On Tue, Aug 25, 2020 at 9:39 PM Pekka Enberg <penberg at gmail.com> wrote:
>
> From: Pekka Enberg <penberg at 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 at github.com:penberg/linux.git penberg/riscv/mm-fault-cleanups

Of course I forgot the sign-off... :-/

Signed-off-by: Pekka Enberg <penberg at kernel.org>

(Updated the commits in the tree behind that git URL to also have the
sign-offs.)

- Pekka



More information about the linux-riscv mailing list