Re: [RFC PATCH v2 10/20] jump_label,module: Don't alloc static_key_mod for __ro_after_init keys

From: Peter Zijlstra
Date: Fri Jul 28 2023 - 18:04:34 EST


On Thu, Jul 20, 2023 at 05:30:46PM +0100, Valentin Schneider wrote:
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>
> When a static_key is marked ro_after_init, its state will never change
> (after init), therefore jump_label_update() will never need to iterate
> the entries, and thus module load won't actually need to track this --
> avoiding the static_key::next write.
>
> Therefore, mark these keys such that jump_label_add_module() might
> recognise them and avoid the modification.
>
> Use the special state: 'static_key_linked(key) && !static_key_mod(key)'
> to denote such keys.
>
> Link: http://lore.kernel.org/r/20230705204142.GB2813335@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> NOT-Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
> ---
> @Peter: I've barely touched this patch, it's just been writing a comment
> and fixing benign compilation issues, so credit's all yours really!

Ah, it works? Excellent! You can remove the NOT from the SoB then ;-)