Skip to content

Commit

Permalink
locking/pvqspinlock: Don't wait if vCPU is preempted
Browse files Browse the repository at this point in the history
If prev node is not in running state or its vCPU is preempted, we can give
up our vCPU slices in pv_wait_node() ASAP.

Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: longman@redhat.com
Link: http://lkml.kernel.org/r/1484035006-6787-1-git-send-email-xinhui.pan@linux.vnet.ibm.com
[ Fixed typos in the changelog, removed ugly linebreak from the code. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Pan Xinhui authored and Ingo Molnar committed Jan 12, 2017
1 parent 607904c commit 75437bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/locking/qspinlock_paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ pv_wait_early(struct pv_node *prev, int loop)
if ((loop & PV_PREV_CHECK_MASK) != 0)
return false;

return READ_ONCE(prev->state) != vcpu_running;
return READ_ONCE(prev->state) != vcpu_running || vcpu_is_preempted(prev->cpu);
}

/*
Expand Down

0 comments on commit 75437bb

Please sign in to comment.