Re: [PATCH v2 4/4] Make finish_task_switch and its subfuncs inline in context switching
From: Peter Zijlstra
Date: Sun Nov 09 2025 - 06:35:48 EST
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.