aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPan Xinhui <[email protected]>2017-01-10 02:56:46 -0500
committerIngo Molnar <[email protected]>2017-01-12 09:35:57 +0100
commit75437bb304b20a2b350b9a8e9f9238d5e24e12ba (patch)
treed8c179d3b1194a8eb7ce8ff9a0c5326dbcc0a01d
parent607904c357c61adf20b8fd18af765e501d61a385 (diff)
locking/pvqspinlock: Don't wait if vCPU is preempted
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 <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] [ Fixed typos in the changelog, removed ugly linebreak from the code. ] Signed-off-by: Ingo Molnar <[email protected]>
-rw-r--r--kernel/locking/qspinlock_paravirt.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index e3b5520005db..e6b2f7ad3e51 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -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);
}
/*