Fix warning about bounded threads migrating
PATCH 1/1 Fix warning about bounded threads migrating
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 <[email protected]>
kernel/sched.c +5 -3
@@ -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);