From: Peter Zijlstra <peterz@infradead.org>
To: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [patch] sched: fix set_task_cpu() and provide an unlocked runqueue variant
Date: Wed, 25 Nov 2009 19:27:52 +0100 [thread overview]
Message-ID: <1259173672.4027.732.camel@laptop> (raw)
In-Reply-To: <1258891781.14325.34.camel@marge.simson.net>
On Sun, 2009-11-22 at 13:09 +0100, Mike Galbraith wrote:
> sched: fix set_task_cpu() and provide an unlocked runqueue variant.
>
> set_task_cpu() falsifies migration stats by unconditionally generating migration
> stats whether a task's cpu actually changed or not. As used in copy_process(),
> the runqueue is unlocked, so we need to provide an unlocked variant which does
> the locking to provide a write barrier.
>
> Signed-off-by: Mike Galbraith <efault@gmx.de>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> LKML-Reference: <new-submission>
>
> ---
> +void set_task_cpu_unlocked(struct task_struct *p, unsigned int new_cpu)
> +{
> + unsigned long flags;
> + struct rq *rq, *new_rq = cpu_rq(new_cpu);
> +
> + smp_wmb();
> + rq = task_rq_lock(p, &flags);
> + update_rq_clock(rq);
> + if (rq != new_rq)
> + update_rq_clock(new_rq);
> + set_task_cpu(p, new_cpu);
> + task_rq_unlock(rq, &flags);
> +}
I've got to ask, what's that barrier for?
next prev parent reply other threads:[~2009-11-25 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 12:09 [patch] sched: fix set_task_cpu() and provide an unlocked runqueue variant Mike Galbraith
2009-11-25 18:27 ` Peter Zijlstra [this message]
2009-11-26 1:01 ` Mike Galbraith
2009-11-26 1:31 ` Mike Galbraith
2009-11-26 9:35 ` Peter Zijlstra
2009-11-26 10:16 ` Mike Galbraith
2009-11-26 14:09 ` Peter Zijlstra
2009-11-26 14:21 ` Peter Zijlstra
2009-11-26 15:32 ` Mike Galbraith
2009-11-26 14:58 ` Mike Galbraith
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=1259173672.4027.732.camel@laptop \
--to=peterz@infradead.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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