[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1484035006-6787-1-git-send-email-xinhui.pan@linux.vnet.ibm.com>
Date: Tue, 10 Jan 2017 02:56:46 -0500
From: Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: mingo@...hat.com, peterz@...radead.org, longman@...hat.com,
Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>
Subject: [PATCH v2] 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 <xinhui.pan@...ux.vnet.ibm.com>
---
v2:
rewrite the commit message as Ingo pointed out the mistake.
---
kernel/locking/qspinlock_paravirt.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
index e3b5520..48648dc 100644
--- a/kernel/locking/qspinlock_paravirt.h
+++ b/kernel/locking/qspinlock_paravirt.h
@@ -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);
}
/*
--
2.4.11
Powered by blists - more mailing lists