aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <[email protected]>2025-02-22 02:44:22 +0000
committerAlexei Starovoitov <[email protected]>2025-02-27 17:29:33 +0000
commit0aaddfb06882504dded9cde57f91035ab9403b82 (patch)
treec827f7f55eba4f7f7b19cdcae10bc7db43f16133 /mm/page_alloc.c
parentLinux 6.14-rc1 (diff)
downloadkernel-0aaddfb06882504dded9cde57f91035ab9403b82.tar.gz
kernel-0aaddfb06882504dded9cde57f91035ab9403b82.zip
locking/local_lock: Introduce localtry_lock_t
In !PREEMPT_RT local_lock_irqsave() disables interrupts to protect critical section, but it doesn't prevent NMI, so the fully reentrant code cannot use local_lock_irqsave() for exclusive access. Introduce localtry_lock_t and localtry_lock_irqsave() that disables interrupts and sets acquired=1, so localtry_lock_irqsave() from NMI attempting to acquire the same lock will return false. In PREEMPT_RT local_lock_irqsave() maps to preemptible spin_lock(). Map localtry_lock_irqsave() to preemptible spin_trylock(). When in hard IRQ or NMI return false right away, since spin_trylock() is not safe due to explicit locking in the underneath rt_spin_trylock() implementation. Removing this explicit locking and attempting only "trylock" is undesired due to PI implications. Note there is no need to use local_inc for acquired variable, since it's a percpu variable with strict nesting scopes. Acked-by: Davidlohr Bueso <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'mm/page_alloc.c')
0 files changed, 0 insertions, 0 deletions