public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "T.Zhou" <t1zhou@163.com>
To: peterz@infradead.org
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire()
Date: Fri, 1 Jul 2016 11:08:01 +0800	[thread overview]
Message-ID: <20160701030801.GA15593@root> (raw)

The second parameter of smp_cond_load_acquire() should be !p->on_cpu
cause remote wakeup need to ensure that: if the task is running on
prev cpu, it should be descheduled before doing the actual wakeup.

Signed-off-by: T.Zhou <t1zhou@163.com>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3387e4f..8e6fef6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2047,7 +2047,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	 * This ensures that tasks getting woken will be fully ordered against
 	 * their previous state and preserve Program Order.
 	 */
-	smp_cond_load_acquire(&p->on_cpu, !VAL);
+	smp_cond_load_acquire(&p->on_cpu, !p->on_cpu);
 
 	p->sched_contributes_to_load = !!task_contributes_to_load(p);
 	p->state = TASK_WAKING;
-- 
2.7.3

             reply	other threads:[~2016-07-01  3:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  3:08 T.Zhou [this message]
2016-07-01  6:55 ` [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160701030801.GA15593@root \
    --to=t1zhou@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox