]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sched: Allow balance callbacks for check_class_changed()
authorPeter Zijlstra <peterz@infradead.org>
Thu, 11 Jun 2015 12:46:39 +0000 (14:46 +0200)
committerJiri Slaby <jslaby@suse.cz>
Thu, 3 Mar 2016 11:45:54 +0000 (12:45 +0100)
commitf4b877aeaabbc0d7ed778ca170fd58272a4a10ee
tree95abddd8a08f287598f57c67458481d74400d511
parent69836a46b1c986665c514106b0137984cacb18dc
sched: Allow balance callbacks for check_class_changed()

commit 4c9a4bc89a9cca8128bce67d6bc8870d6b7ee0b2 upstream.

In order to remove dropping rq->lock from the
switched_{to,from}()/prio_changed() sched_class methods, run the
balance callbacks after it.

We need to remove dropping rq->lock because its buggy,
suppose using sched_setattr()/sched_setscheduler() to change a running
task from FIFO to OTHER.

By the time we get to switched_from_rt() the task is already enqueued
on the cfs runqueues. If switched_from_rt() does pull_rt_task() and
drops rq->lock, load-balancing can come in and move our task @p to
another rq.

The subsequent switched_to_fair() still assumes @p is on @rq and bad
things will happen.

By using balance callbacks we delay the load-balancing operations
{rt,dl}x{push,pull} until we've done all the important work and the
task is fully set up.

Furthermore, the balance callbacks do not know about @p, therefore
they cannot get confused like this.

Reported-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: ktkhai@parallels.com
Cc: rostedt@goodmis.org
Cc: juri.lelli@gmail.com
Cc: pang.xunlei@linaro.org
Cc: oleg@redhat.com
Cc: wanpeng.li@linux.intel.com
Link: http://lkml.kernel.org/r/20150611124742.615343911@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
kernel/sched/core.c