From: Peter Zijlstra <peterz@infradead.org>
To: Kirill Tkhai <tkhai@yandex.ru>
Cc: "riel@redhat.com" <riel@redhat.com>,
"laijs@cn.fujitsu.com" <laijs@cn.fujitsu.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mingo@kernel.org" <mingo@kernel.org>
Subject: Re: [PATCH] sched: Fix migration_cpu_stop() return value
Date: Wed, 4 Jun 2014 14:29:09 +0200 [thread overview]
Message-ID: <20140604122909.GE13658@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140604120338.GH13930@laptop.programming.kicks-ass.net>
[-- Attachment #1: Type: text/plain, Size: 2118 bytes --]
On Wed, Jun 04, 2014 at 02:03:38PM +0200, Peter Zijlstra wrote:
> On Wed, Jun 04, 2014 at 03:18:45PM +0400, Kirill Tkhai wrote:
> > Hi, Peter,
> >
> > 04.06.2014, 14:41, "Peter Zijlstra" <peterz@infradead.org>:
> > > A while ago I did a similar patch for some debugging, but looking at it
> > > again today I realized we should probably fix this anyway.
> > >
> > > ---
> > > Subject: sched: Fix migration_cpu_stop() return value
> > >
> > > There are a number of migration_cpu_stop() users; and some actually care
> > > about the success of the migration. So report this.
> > >
> > > In particular migrate_task_to() as used from task_numa_migrate()
> > > actually tests this return value.
> > >
> > > Also change set_cpus_allowed_ptr() to propagate this return value, since
> > > it already returns other errors.
> > >
> > > Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > Cc: Ingo Molnar <mingo@redhat.com>
> > > Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> > > ---
> > > kernel/sched/core.c | 15 +++++++++++----
> > > 1 file changed, 11 insertions(+), 4 deletions(-)
> > (snipped everything because of bad email editor)
> >
> > In set_cpus_allowed_ptr() p->on_rq branch can not fail.
> >
> > We've changed affinity and released rq's lock, so task can migrate
> > on allowed cpu only (even if migration_cpu_stop fails).
> >
> > And it's a little ambiguously how user should react on this EAGAIN.
>
> Try again? So one reason it might fail is because the task got migrated
> in between the stop_cpu_call(migration_cpu_stop) call getting to
> __migrate_task().
>
> Esp. if you look at migrate_task_to() its fairly easy to fail this.
> Currently it reports success, even though we completely failed to
> migrate.
>
> On -EAGAIN, re-evaluate the target and try again (later). Like for the
> numa case, we'll try again on the next task_numa_migrate() call if its
> still relevant.
Argh, I just realized that the one case the numa code is interested in
is actually reported as success (task_cpu() != cpu).
I'll go make a new patch..
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2014-06-04 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 10:41 [PATCH] sched: Fix migration_cpu_stop() return value Peter Zijlstra
2014-06-04 11:10 ` Lai Jiangshan
2014-06-04 11:18 ` Kirill Tkhai
2014-06-04 12:03 ` Peter Zijlstra
2014-06-04 12:29 ` Peter Zijlstra [this message]
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=20140604122909.GE13658@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=riel@redhat.com \
--cc=tkhai@yandex.ru \
/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