Skip to content

Commit dda1c41

Browse files
Sebastian Andrzej Siewiorakpm00
authored andcommitted
mm: multi-gen LRU: move lru_gen_add_mm() out of IRQ-off region
lru_gen_add_mm() has been added within an IRQ-off region in the commit mentioned below. The other invocations of lru_gen_add_mm() are not within an IRQ-off region. The invocation within IRQ-off region is problematic on PREEMPT_RT because the function is using a spin_lock_t which must not be used within IRQ-disabled regions. The other invocations of lru_gen_add_mm() occur while task_struct::alloc_lock is acquired. Move lru_gen_add_mm() after interrupts are enabled and before task_unlock(). Link: https://lkml.kernel.org/r/20221026134830.711887-1-bigeasy@linutronix.de Fixes: bd74fda ("mm: multi-gen LRU: support page table walks") Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Yu Zhao <yuzhao@google.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: "Eric W . Biederman" <ebiederm@xmission.com> Cc: Kees Cook <keescook@chromium.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1b9c918 commit dda1c41

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,6 @@ static int exec_mmap(struct mm_struct *mm)
10121012
active_mm = tsk->active_mm;
10131013
tsk->active_mm = mm;
10141014
tsk->mm = mm;
1015-
lru_gen_add_mm(mm);
10161015
/*
10171016
* This prevents preemption while active_mm is being loaded and
10181017
* it and mm are being updated, which could cause problems for
@@ -1025,6 +1024,7 @@ static int exec_mmap(struct mm_struct *mm)
10251024
activate_mm(active_mm, mm);
10261025
if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM))
10271026
local_irq_enable();
1027+
lru_gen_add_mm(mm);
10281028
task_unlock(tsk);
10291029
lru_gen_use_mm(mm);
10301030
if (old_mm) {

0 commit comments

Comments
 (0)