mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 11:56:58 +07:00
bf67fd3142
This patch introduces a wfe-based polling loop for spinning on contended MCS locks and waking up corresponding waiters when the lock is released. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
24 lines
531 B
C
24 lines
531 B
C
#ifndef __ASM_MCS_LOCK_H
|
|
#define __ASM_MCS_LOCK_H
|
|
|
|
#ifdef CONFIG_SMP
|
|
#include <asm/spinlock.h>
|
|
|
|
/* MCS spin-locking. */
|
|
#define arch_mcs_spin_lock_contended(lock) \
|
|
do { \
|
|
/* Ensure prior stores are observed before we enter wfe. */ \
|
|
smp_mb(); \
|
|
while (!(smp_load_acquire(lock))) \
|
|
wfe(); \
|
|
} while (0) \
|
|
|
|
#define arch_mcs_spin_unlock_contended(lock) \
|
|
do { \
|
|
smp_store_release(lock, 1); \
|
|
dsb_sev(); \
|
|
} while (0)
|
|
|
|
#endif /* CONFIG_SMP */
|
|
#endif /* __ASM_MCS_LOCK_H */
|