[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1481049850-42610-1-git-send-email-xinhui.pan@linux.vnet.ibm.com>
Date: Tue, 6 Dec 2016 13:44:10 -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] locking/pvqspinlock: Wait early if vcpu is preempted
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@...ux.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
Powered by blists - more mailing lists