[PATCH v2 4/4] Make finish_task_switch and its subfuncs inline in context switching
Peter Zijlstra
peterz at infradead.org
Sun Nov 9 03:35:33 PST 2025
On Sun, Nov 09, 2025 at 01:23:46AM +0800, Xie Yuanbin wrote:
> `finish_task_switch` is a hot path in context switching, and due to
> possible mitigations inside switch_mm, performance here is greatly
> affected by function calls and branch jumps. Make it inline to optimize
> the performance.
>
> After `finish_task_switch` is changed to an inline function, the number of
> calls to the subfunctions (called by `finish_task_switch`) increases in
> this translation unit due to the inline expansion of `finish_task_switch`.
> Due to compiler optimization strategies, these functions may transition
> from inline functions to non inline functions, which can actually lead to
> performance degradation.
>
> Make the subfunctions of finish_task_stwitch inline to prevent
> degradation.
Yeah, try again without that _ainline garbage.
More information about the linux-riscv
mailing list