* [PATCH] mm: multi-gen LRU: Move lru_gen_add_mm() out of IRQ-off region.
@ 2022-10-26 13:48 Sebastian Andrzej Siewior
2022-10-26 18:08 ` Yu Zhao
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-10-26 13:48 UTC (permalink / raw)
To: linux-fsdevel, linux-mm
Cc: Alexander Viro, Eric Biederman, Kees Cook, Yu Zhao,
Andrew Morton, Thomas Gleixner, Sebastian Andrzej Siewior
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().
Fixes: bd74fdaea1460 ("mm: multi-gen LRU: support page table walks")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
fs/exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1012,7 +1012,6 @@ static int exec_mmap(struct mm_struct *m
active_mm = tsk->active_mm;
tsk->active_mm = mm;
tsk->mm = mm;
- lru_gen_add_mm(mm);
/*
* This prevents preemption while active_mm is being loaded and
* it and mm are being updated, which could cause problems for
@@ -1025,6 +1024,7 @@ static int exec_mmap(struct mm_struct *m
activate_mm(active_mm, mm);
if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM))
local_irq_enable();
+ lru_gen_add_mm(mm);
task_unlock(tsk);
lru_gen_use_mm(mm);
if (old_mm) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: multi-gen LRU: Move lru_gen_add_mm() out of IRQ-off region.
2022-10-26 13:48 [PATCH] mm: multi-gen LRU: Move lru_gen_add_mm() out of IRQ-off region Sebastian Andrzej Siewior
@ 2022-10-26 18:08 ` Yu Zhao
0 siblings, 0 replies; 2+ messages in thread
From: Yu Zhao @ 2022-10-26 18:08 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-fsdevel, linux-mm, Alexander Viro, Eric Biederman,
Kees Cook, Andrew Morton, Thomas Gleixner
On Wed, Oct 26, 2022 at 7:49 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> 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().
>
> Fixes: bd74fdaea1460 ("mm: multi-gen LRU: support page table walks")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Thanks.
Acked-by: Yu Zhao <yuzhao@google.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-26 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 13:48 [PATCH] mm: multi-gen LRU: Move lru_gen_add_mm() out of IRQ-off region Sebastian Andrzej Siewior
2022-10-26 18:08 ` Yu Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox