Skip to content

Commit

Permalink
ARM: 8098/1: mcs lock: implement wfe-based polling for MCS locking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Will Deacon authored and Russell King committed Jul 18, 2014
1 parent e38361d commit bf67fd3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions arch/arm/include/asm/mcs_spinlock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#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 */

0 comments on commit bf67fd3

Please sign in to comment.