locking/pvqspinlock: Wait early if vCPU is preempted
PATCH v2 1/1 locking/pvqspinlock: Wait early if vCPU is preempted
If prev node is not in runnig state or its vCPU is preempted, we can give up our vCPU slices ASAP in pv_wait_node. After commit d9345c65eb79 ("sched/core: Introduce the vcpu_is_preempted(cpu) interface") kernel has knowledge of one vCPU is running or not.
Signed-off-by Pan Xinhui <[email protected]>
---
v2:
rewrite the commit message as Ingo pointed out the mistake.
--- kernel/locking/qspinlock_paravirt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/locking/qspinlock_paravirt.h +2 -1
@@ -263,7 +263,8 @@ 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); }/*
Signature · 1 line
2.4.11
tip-bot for Pan Xinhui
merge bot[tip:locking/core] locking/pvqspinlock: Don't wait if vCPU is preempted
locking/pvqspinlock: Don't wait if vCPU is preempted
Commit-ID: 75437bb304b20a2b350b9a8e9f9238d5e24e12ba Gitweb: http://git.kernel.org/tip/75437bb304b20a2b350b9a8e9f9238d5e24e12ba Author: Pan Xinhui <[email protected]> AuthorDate: Tue, 10 Jan 2017 02:56:46 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 12 Jan 2017 09:35:57 +0100
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]>
[ Fixed typos in the changelog, removed ugly linebreak from the code. ]
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/locking/qspinlock_paravirt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/qspinlock_paravirt.h +1 -1
@@ -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); }/*