[PATCH 3/3] Set the subfunctions called by finish_task_switch to be inline
Xie Yuanbin
qq570070308 at gmail.com
Sat Oct 25 11:51:20 PDT 2025
On Fri, 24 Oct 2025 21:44:10 +0200, Thomas Gleixner wrote:
> What is exactly the point of this indirection. Why can't you just mark
> finish_arch_post_lock_switch() __always_inline and be done with it?
In this patch, I've added an always inline version of the function,
finish_arch_post_lock_switch_ainline. The original function,
finish_arch_post_lock_switch, retains its original inline attribute.
The reason for this is that this function is called not only during
context switches but also from other code, and I don't want to affect
those parts. In fact, with Os/Oz-level optimizations, if this function
is called multiple times within one .c file, it will most likely not be
inlined, even if it's marked as inline.
Context switching is a hot code, I hope it will be always inlined here to
improve performance. In other places, if it is not a performance-critical
function, then it can be not inlined to gain codesize benefits.
Look at your opinions. I have no objection to setting
finish_arch_post_lock_switch directly to __always_inline.
Xie Yuanbin
More information about the linux-riscv
mailing list