# Re: \[RFC PATCH v2 10/20\] jump\_label,module: Don't alloc static\_key\_mod for \_\_ro\_after\_init keys

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2023-07-28 22:04:34 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2023/07/2283798
- Thread: https://ratatoskr.run/linux-trace-kernel/2023/07/2272830/t.md

```text
On Thu, Jul 20, 2023 at 05:30:46PM +0100, Valentin Schneider wrote:
> From: Peter Zijlstra <peterz@infradead.org>
> 
> 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@hirez.programming.kicks-ass.net
> NOT-Signed-off-by: Peter Zijlstra (Intel) [ref]
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> ---
> @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 ;-)
```
