Skip to content

Commit 4038131

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
jump_label: Use RCU in all users of __module_address().
__module_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_address() with RCU. Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Jason Baron <jbaron@akamai.com> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250108090457.512198-24-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent 14daa3b commit 4038131

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

kernel/jump_label.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ static int jump_label_add_module(struct module *mod)
746746
kfree(jlm);
747747
return -ENOMEM;
748748
}
749-
preempt_disable();
750-
jlm2->mod = __module_address((unsigned long)key);
751-
preempt_enable();
749+
scoped_guard(rcu)
750+
jlm2->mod = __module_address((unsigned long)key);
751+
752752
jlm2->entries = static_key_entries(key);
753753
jlm2->next = NULL;
754754
static_key_set_mod(key, jlm2);
@@ -906,13 +906,13 @@ static void jump_label_update(struct static_key *key)
906906
return;
907907
}
908908

909-
preempt_disable();
910-
mod = __module_address((unsigned long)key);
911-
if (mod) {
912-
stop = mod->jump_entries + mod->num_jump_entries;
913-
init = mod->state == MODULE_STATE_COMING;
909+
scoped_guard(rcu) {
910+
mod = __module_address((unsigned long)key);
911+
if (mod) {
912+
stop = mod->jump_entries + mod->num_jump_entries;
913+
init = mod->state == MODULE_STATE_COMING;
914+
}
914915
}
915-
preempt_enable();
916916
#endif
917917
entry = static_key_entries(key);
918918
/* if there are no users, entry can be NULL */

0 commit comments

Comments
 (0)