[PATCH][RT] Fix warning about bounded threads migrating

From: Steven Rostedt
Date: Thu Sep 29 2011 - 10:57:26 EST


Clark can you add this patch. You can fold it into the first one if you
want.

The warning for the PF_THREAD_BOUND migrating was causing false reports
because a task that is created on one CPU and bound to another CPU with
kthread_bind() may migrate on wakeup triggering this message. There is
nothing wrong with the use of migrating a thread that was recently
created.

Instead, only warn if the weight of the task's cpus_allowed is greater
than one. That is a clear warning that someone is abusing the
PF_THREAD_BOUND flag.

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

Index: linux-mrg.git/kernel/sched.c
===================================================================
--- linux-mrg.git.orig/kernel/sched.c
+++ linux-mrg.git/kernel/sched.c
@@ -2246,9 +2246,11 @@ void set_task_cpu(struct task_struct *p,
if (task_cpu(p) != new_cpu) {
p->se.nr_migrations++;
perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
- if (WARN_ON(p->flags & PF_THREAD_BOUND))
- printk(KERN_WARNING "migrating bounded task %s:%d\n",
- p->comm, p->pid);
+ if (WARN(p->flags & PF_THREAD_BOUND &&
+ cpumask_weight(tsk_cpus_allowed(p)) > 1,
+ "migrating bounded task %s:%d\n",
+ p->comm, p->pid))
+ return;
}

__set_task_cpu(p, new_cpu);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/