Skip to content

Commit 1e6d5f7

Browse files
npigginmpe
authored andcommitted
powerpc/qspinlock: Propagate sleepy if previous waiter is preempted
The sleepy (aka lock-owner-is-preempted) condition is propagated down the queue by each waiter. If a waiter becomes preempted, it can no longer propagate sleepy. To allow subsequent waiters to yield to the lock owner, also check the lock owner in this case. Signed-off-by: Nicholas Piggin <[email protected]> Tested-by: Shrikanth Hegde <[email protected]> Reviewed-by: "Nysal Jan K.A" <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent fcf77d4 commit 1e6d5f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/powerpc/lib/qspinlock.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,11 @@ static __always_inline bool yield_to_prev(struct qspinlock *lock, struct qnode *
384384
if (!pv_yield_propagate_owner)
385385
goto yield_prev;
386386

387-
if (node->sleepy) {
387+
/*
388+
* If the previous waiter was preempted it might not be able to
389+
* propagate sleepy to us, so check the lock in that case too.
390+
*/
391+
if (node->sleepy || vcpu_is_preempted(prev_cpu)) {
388392
u32 val = READ_ONCE(lock->val);
389393

390394
if (val & _Q_LOCKED_VAL) {

0 commit comments

Comments
 (0)