#ifdef CONFIG_PPC64 /* * Use the EH=1 hint for accesses that result in the lock being acquired. * The hardware is supposed to optimise this pattern by holding the lock * cacheline longer, and releasing when a store to the same memory (the * unlock) is performed.
*/ #define _Q_SPIN_EH_HINT 1 #else #define _Q_SPIN_EH_HINT 0 #endif
/* * The trylock itself may steal. This makes trylocks slightly stronger, and * makes locks slightly more efficient when stealing. * * This is compile-time, so if true then there may always be stealers, so the * nosteal paths become unused.
*/ #define _Q_SPIN_TRY_LOCK_STEAL 1
/* * Put a speculation barrier after testing the lock/node and finding it * busy. Try to prevent pointless speculation in slow paths. * * Slows down the lockstorm microbenchmark with no stealing, where locking * is purely FIFO through the queue. May have more benefit in real workload * where speculating into the wrong place could have a greater cost.
*/ #define _Q_SPIN_SPEC_BARRIER 0
#ifdef CONFIG_PPC64 /* * Execute a miso instruction after passing the MCS lock ownership to the * queue head. Miso is intended to make stores visible to other CPUs sooner. * * This seems to make the lockstorm microbenchmark nospin test go slightly * faster on POWER10, but disable for now.
*/ #define _Q_SPIN_MISO 0 #else #define _Q_SPIN_MISO 0 #endif
#ifdef CONFIG_PPC64 /* * This executes miso after an unlock of the lock word, having ownership * pass to the next CPU sooner. This will slow the uncontended path to some * degree. Not evidence it helps yet.
*/ #define _Q_SPIN_MISO_UNLOCK 0 #else #define _Q_SPIN_MISO_UNLOCK 0 #endif
/* * Seems to slow down lockstorm microbenchmark, suspect queue node just * has to become shared again right afterwards when its waiter spins on * the lock field.
*/ #define _Q_SPIN_PREFETCH_NEXT 0
static __always_inline int queued_spin_is_locked(struct qspinlock *lock)
{ return READ_ONCE(lock->val);
}
static __always_inline int queued_spin_value_unlocked(struct qspinlock lock)
{ return !lock.val;
}
static __always_inline u32 queued_spin_encode_locked_val(void)
{ /* XXX: make this use lock value in paca like simple spinlocks? */ return _Q_LOCKED_VAL | (smp_processor_id() << _Q_OWNER_CPU_OFFSET);
}
static __always_inline int __queued_spin_trylock_nosteal(struct qspinlock *lock)
{
u32 new = queued_spin_encode_locked_val();
u32 prev;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.