]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
sched/fair: Restore previous rq_flags when migrating tasks in hotplug
authorMatt Fleming <matt@codeblueprint.co.uk>
Wed, 26 Oct 2016 15:15:44 +0000 (16:15 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 30 Jan 2017 10:46:35 +0000 (11:46 +0100)
__migrate_task() can return with a different runqueue locked than the
one we passed as an argument. So that we can repin the lock in
migrate_tasks() (and keep the update_rq_clock() bit) we need to
restore the old rq_flags before repinning.

Note that it wouldn't be correct to change move_queued_task() to repin
because of the change of runqueue and the fact that having an
up-to-date clock on the initial rq doesn't mean the new rq has one
too.

Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c

index 7f983e83a353556621d284731a6dd7a1395dcf10..3b248b03ad8f8ea8bf0e833775afcc526da4f730 100644 (file)
@@ -5608,7 +5608,7 @@ static void migrate_tasks(struct rq *dead_rq)
 {
        struct rq *rq = dead_rq;
        struct task_struct *next, *stop = rq->stop;
-       struct rq_flags rf;
+       struct rq_flags rf, old_rf;
        int dest_cpu;
 
        /*
@@ -5669,6 +5669,13 @@ static void migrate_tasks(struct rq *dead_rq)
                        continue;
                }
 
+               /*
+                * __migrate_task() may return with a different
+                * rq->lock held and a new cookie in 'rf', but we need
+                * to preserve rf::clock_update_flags for 'dead_rq'.
+                */
+               old_rf = rf;
+
                /* Find suitable destination for @next, with force if needed. */
                dest_cpu = select_fallback_rq(dead_rq->cpu, next);
 
@@ -5677,6 +5684,7 @@ static void migrate_tasks(struct rq *dead_rq)
                        raw_spin_unlock(&rq->lock);
                        rq = dead_rq;
                        raw_spin_lock(&rq->lock);
+                       rf = old_rf;
                }
                raw_spin_unlock(&next->pi_lock);
        }