History

locking/pvqspinlock: Kick the PV CPU unconditionally when _Q_SLOW_VAL

If _Q_SLOW_VAL has been set, the vCPU state must have been vcpu_hashed. The extra check at the end of __pv_queued_spin_unlock() is unnecessary and can be removed.

Waiman Long committed 11 years ago

Commit 93edc8b1 parent c55a6ff1 file · +1 −5Browse files

Unified · Split

kernel/locking/qspinlock_paravirt.h+1−5
@@ -267,7 +267,6 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node) · 266 unmodified lines
267267 }
268268
269269 if (!lp) { /* ONCE */
270− WRITE_ONCE(pn->state, vcpu_hashed);
271270 lp = pv_hash(lock, pn);
272271
273272 /*
@@ -275,11 +274,9 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node) · 1 unmodified line
275274 * when we observe _Q_SLOW_VAL in __pv_queued_spin_unlock()
276275 * we'll be sure to be able to observe our hash entry.
277276 *
278− * [S] pn->state
279277 * [S] <hash> [Rmw] l->locked == _Q_SLOW_VAL
280278 * MB RMB
281279 * [RmW] l->locked = _Q_SLOW_VAL [L] <unhash>
282− * [L] pn->state
283280 *
284281 * Matches the smp_rmb() in __pv_queued_spin_unlock().
285282 */
@@ -364,8 +361,7 @@ __visible void __pv_queued_spin_unlock(struct qspinlock *lock) · 78 unmodified lines
364361 * vCPU is harmless other than the additional latency in completing
365362 * the unlock.
366363 */
367− if (READ_ONCE(node->state) == vcpu_hashed)
368− pv_kick(node->cpu);
364+ pv_kick(node->cpu);
369365 }
370366 /*
371367 * Include the architecture specific callee-save thunk of the