blob: 76fabf4b0873ba488ecfe323b8588f922208893e [file] [log] [blame]
Subject: sched, rt: Fix migrate_enable() thinko
From: Mike Galbraith <efault@gmx.de>
Date: Tue, 23 Aug 2011 16:12:43 +0200
Assigning mask = tsk_cpus_allowed(p) after p->migrate_disable = 0 ensures
that we won't see a mask change.. no push/pull, we stack tasks on one CPU.
Also add a couple fields to sched_debug for the next guy.
[ Build fix from Stratos Psomadakis <psomas@gentoo.org> ]
Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Paul E. McKenney <paulmck@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1314108763.6689.4.camel@marge.simson.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/sched/core.c | 4 +++-
kernel/sched/debug.c | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)
Index: linux-stable/kernel/sched/core.c
===================================================================
--- linux-stable.orig/kernel/sched/core.c
+++ linux-stable/kernel/sched/core.c
@@ -5355,12 +5355,14 @@ void migrate_enable(void)
*/
rq = this_rq();
raw_spin_lock_irqsave(&rq->lock, flags);
- p->migrate_disable = 0;
mask = tsk_cpus_allowed(p);
+ p->migrate_disable = 0;
WARN_ON(!cpumask_test_cpu(smp_processor_id(), mask));
if (!cpumask_equal(&p->cpus_allowed, mask)) {
+ /* Get the mask now that migration is enabled */
+ mask = tsk_cpus_allowed(p);
if (p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, mask);
p->nr_cpus_allowed = cpumask_weight(mask);
Index: linux-stable/kernel/sched/debug.c
===================================================================
--- linux-stable.orig/kernel/sched/debug.c
+++ linux-stable/kernel/sched/debug.c
@@ -237,6 +237,9 @@ void print_rt_rq(struct seq_file *m, int
P(rt_throttled);
PN(rt_time);
PN(rt_runtime);
+#ifdef CONFIG_SMP
+ P(rt_nr_migratory);
+#endif
#undef PN
#undef P
@@ -491,6 +494,10 @@ void proc_sched_show_task(struct task_st
P(se.load.weight);
P(policy);
P(prio);
+#ifdef CONFIG_PREEMPT_RT_FULL
+ P(migrate_disable);
+#endif
+ P(nr_cpus_allowed);
#undef PN
#undef __PN
#undef P