public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted
@ 2016-12-06 18:44 Pan Xinhui
  2017-01-05  8:23 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Xinhui @ 2016-12-06 18:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, longman, Pan Xinhui

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted
  2016-12-06 18:44 [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted Pan Xinhui
@ 2017-01-05  8:23 ` Ingo Molnar
  2017-01-05  8:44   ` Pan Xinhui
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2017-01-05  8:23 UTC (permalink / raw)
  To: Pan Xinhui; +Cc: linux-kernel, mingo, peterz, longman


* Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> wrote:

> 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.

That's not how we reference upstream commits. I had to search the git log the hard 
way to figure out that it's commit d9345c65eb79 ...

Also, once you look at that commit you'll see how sloppy the capitalization in 
your changelog is. I fixed that up for all the original commits in the hope of you 
learning from those mistakes - but that was last year and the experiment failed.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted
  2017-01-05  8:23 ` Ingo Molnar
@ 2017-01-05  8:44   ` Pan Xinhui
  0 siblings, 0 replies; 3+ messages in thread
From: Pan Xinhui @ 2017-01-05  8:44 UTC (permalink / raw)
  To: Ingo Molnar, Pan Xinhui; +Cc: linux-kernel, mingo, peterz, longman



在 2017/1/5 16:23, Ingo Molnar 写道:
>
> * Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> wrote:
>
>> 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.
>
> That's not how we reference upstream commits. I had to search the git log the hard
> way to figure out that it's commit d9345c65eb79 ...
>
hi, Ingo
	Sorry. Such stupid mistake will not happen next time.

> Also, once you look at that commit you'll see how sloppy the capitalization in
> your changelog is. I fixed that up for all the original commits in the hope of you
> learning from those mistakes - but that was last year and the experiment failed.
>
So sorry, I pay most attention on spelling of words. :(
Maybe I rely on the tools of ./scripts/checkpatch.pl too much.
I will rewrite the comments and resend this patch.

> Thanks,
>
> 	Ingo
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-05  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06 18:44 [PATCH] locking/pvqspinlock: Wait early if vcpu is preempted Pan Xinhui
2017-01-05  8:23 ` Ingo Molnar
2017-01-05  8:44   ` Pan Xinhui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox