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

Showing the changes to kernel/locking (1 of 1 file). Show all

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
267 }267 }
268 268
269 if (!lp) { /* ONCE */269 if (!lp) { /* ONCE */
270 WRITE_ONCE(pn->state, vcpu_hashed);
271 lp = pv_hash(lock, pn);270 lp = pv_hash(lock, pn);
272 271
273 /*272 /*
@@ -275,11 +274,9 @@ static void pv_wait_head(struct qspinlock *lock, struct mcs_spinlock *node) · 1 unmodified line
275 * when we observe _Q_SLOW_VAL in __pv_queued_spin_unlock()274 * when we observe _Q_SLOW_VAL in __pv_queued_spin_unlock()
276 * we'll be sure to be able to observe our hash entry.275 * we'll be sure to be able to observe our hash entry.
277 *276 *
278 * [S] pn->state
279 * [S] <hash> [Rmw] l->locked == _Q_SLOW_VAL277 * [S] <hash> [Rmw] l->locked == _Q_SLOW_VAL
280 * MB RMB278 * MB RMB
281 * [RmW] l->locked = _Q_SLOW_VAL [L] <unhash>279 * [RmW] l->locked = _Q_SLOW_VAL [L] <unhash>
282 * [L] pn->state
283 *280 *
284 * Matches the smp_rmb() in __pv_queued_spin_unlock().281 * Matches the smp_rmb() in __pv_queued_spin_unlock().
285 */282 */
@@ -364,8 +361,7 @@ __visible void __pv_queued_spin_unlock(struct qspinlock *lock) · 78 unmodified lines
364 * vCPU is harmless other than the additional latency in completing361 * vCPU is harmless other than the additional latency in completing
365 * the unlock.362 * the unlock.
366 */363 */
367 if (READ_ONCE(node->state) == vcpu_hashed)364 pv_kick(node->cpu);
368 pv_kick(node->cpu);
369}365}
370/*366/*
371 * Include the architecture specific callee-save thunk of the367 * Include the architecture specific callee-save thunk of the