Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1537113

[PATCH] locking/pvqspinlock: Wait early if vcpu is preempted

From Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted
Date 2016-12-06 18:00 +0100
Message-ID <sLrfY-4AN-53@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


If prev node is not in runnig state or its cpu is preempted, we need
wait early in pv_wait_node. After commit "sched/core: Introduce the
vcpu_is_preempted(cpu) interface" kernel has knowledge of one vcpu is
running or not. So lets use it.

Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
---
 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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] locking/pvqspinlock: Wait early if vcpu is preempted Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-12-06 18:00 +0100

csiph-web