Skip to content

Commit 3983da3

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
static_call: Use RCU in all users of __module_text_address().
__module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_text_address() with RCU. 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-28-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent 7e74a7c commit 3983da3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

kernel/static_call_inline.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,12 @@ static int __static_call_mod_text_reserved(void *start, void *end)
325325
struct module *mod;
326326
int ret;
327327

328-
preempt_disable();
329-
mod = __module_text_address((unsigned long)start);
330-
WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
331-
if (!try_module_get(mod))
332-
mod = NULL;
333-
preempt_enable();
334-
328+
scoped_guard(rcu) {
329+
mod = __module_text_address((unsigned long)start);
330+
WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
331+
if (!try_module_get(mod))
332+
mod = NULL;
333+
}
335334
if (!mod)
336335
return 0;
337336

0 commit comments

Comments
 (0)