BACKPORT: mm: multi-gen LRU: move lru_gen_add_mm() out of IRQ-off region
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 26 Oct 2022 13:48:30 +0000 (15:48 +0200)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 17 Jan 2024 17:15:54 +0000 (18:15 +0100)
commitda7988723345ed5081ee978a740965dc6f87bada
treee4d80b9ec3124268dc21bb27e44df1575759a33c
parent18a7b6a8d4ac87b7830a26c8463106f7a5a1d4b0
BACKPORT: 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().

Bug: 254441685
Link: https://lkml.kernel.org/r/20221026134830.711887-1-bigeasy@linutronix.de
Fixes: bd74fdaea1460 ("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>
(cherry picked from commit dda1c41a07b4a4c3f99b5b28c1e8c485205fe860)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I0ab2d5811f6c8df16a4deb58ab6aa9717eac565f
[backport of the commit ad8cc978ccc17a0fd1149ebd76407b629907a727 from android13-5.15 branch]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
fs/exec.c