diff options
author | Peter Zijlstra <peterz@infradead.org> | 2024-03-13 19:01:03 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-03-22 11:18:16 +0100 |
commit | 91a1d97ef482c1e4c9d4c1c656a53b0f6b16d0ed (patch) | |
tree | 0a5984cd9f64775013f069da345663f8330854c9 /include/linux/jump_label.h | |
parent | 3774b28d8f3b9e8a946beb9550bee85e5454fc9f (diff) | |
download | lwn-91a1d97ef482c1e4c9d4c1c656a53b0f6b16d0ed.tar.gz lwn-91a1d97ef482c1e4c9d4c1c656a53b0f6b16d0ed.zip |
jump_label,module: Don't alloc static_key_mod for __ro_after_init keys
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.
jump_label_add_module() does not exist under CONFIG_JUMP_LABEL=n, so the
newly-introduced jump_label_init_ro() can be defined as a nop for that
configuration.
[ mingo: Renamed jump_label_ro() to jump_label_init_ro() ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20240313180106.2917308-2-vschneid@redhat.com
Diffstat (limited to 'include/linux/jump_label.h')
-rw-r--r-- | include/linux/jump_label.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index f0a949b7c973..f5a2727ca4a9 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -216,6 +216,7 @@ extern struct jump_entry __start___jump_table[]; extern struct jump_entry __stop___jump_table[]; extern void jump_label_init(void); +extern void jump_label_init_ro(void); extern void jump_label_lock(void); extern void jump_label_unlock(void); extern void arch_jump_label_transform(struct jump_entry *entry, @@ -265,6 +266,8 @@ static __always_inline void jump_label_init(void) static_key_initialized = true; } +static __always_inline void jump_label_init_ro(void) { } + static __always_inline bool static_key_false(struct static_key *key) { if (unlikely_notrace(static_key_count(key) > 0)) |