kexec: use atomic_try_cmpxchg in crash_kexec
authorUros Bizjak <ubizjak@gmail.com>
Tue, 14 Nov 2023 16:12:01 +0000 (17:12 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 11 Dec 2023 01:21:33 +0000 (17:21 -0800)
commit0311d8272406b2ec47f485bef887723cc352a489
tree0938025c927835f78755743039c308cf598bd3fc
parent1ee918ffa6d4776a69708b013fd7e7006619158a
kexec: use atomic_try_cmpxchg in crash_kexec

Use atomic_try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
crash_kexec().  x86 CMPXCHG instruction returns success in ZF flag,
so this change saves a compare after cmpxchg.

No functional change intended.

Link: https://lkml.kernel.org/r/20231114161228.108516-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/kexec_core.c