public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: sched_setscheduler() vs idle_balance() race
Date: Thu, 28 May 2015 09:43:52 +0200	[thread overview]
Message-ID: <1432799032.3237.119.camel@gmail.com> (raw)

Hi Peter,

I'm not seeing what prevents pull_task() from yanking a task out from
under __sched_setscheduler().  A box sprinkling smoldering 3.0 kernel
wreckage all over my bugzilla mbox isn't seeing it either ;-)

Scenario: rt task forks, wakes child to CPU foo, immediately tries to
change child to fair class, calls switched_from_rt(), that leads to
pull_rt_task() -> double_lock_balance() which momentarily drops child's
rq->lock, letting some prick doing idle balancing over on CPU bar in to
migrate the child.  Rt parent then calls switched_to_fair(), and box
explodes when we use the passed rq as if the child still lived there.

I sent a patchlet to verify that the diagnosis is really really correct
(can_migrate_task() says no if ->pi_lock is held), but I think it is,
the 8x10 color glossy with circles and arrows clearly shows both tasks
with their grubby mitts on that child at the same time, each thinking it
has that child locked down tight.

Not seeing what should prevent that in mainline either, I'll just ask
while I wait to (hopefully) hear "yup, all better".

	-Mike


             reply	other threads:[~2015-05-28  7:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28  7:43 Mike Galbraith [this message]
2015-05-28 11:51 ` sched_setscheduler() vs idle_balance() race Peter Zijlstra
2015-05-28 12:04   ` Mike Galbraith
2015-05-28 12:06     ` Peter Zijlstra
2015-05-28 12:32       ` Mike Galbraith
2015-05-28 13:53 ` Peter Zijlstra
2015-05-28 14:54   ` Mike Galbraith
2015-05-28 15:24     ` Peter Zijlstra
2015-05-29 18:30       ` Mike Galbraith
2015-05-29 18:48         ` Mike Galbraith
2015-06-01  8:14           ` Peter Zijlstra
2015-06-01  8:16         ` Peter Zijlstra
2015-06-01 10:00           ` Mike Galbraith
2015-05-28 16:59   ` Kirill Tkhai
2015-05-30 13:08   ` Mike Galbraith
2015-05-31  6:39     ` Mike Galbraith
2015-06-01  8:24       ` Peter Zijlstra
2015-06-01  8:19     ` 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=1432799032.3237.119.camel@gmail.com \
    --to=umgwanakikbuti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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