kthread_bind: use wait_task_inactive(TASK_UNINTERRUPTIBLE)
Now that wait_task_inactive(task, state) checks task->state == state, we can simplify the code and make this debugging check more robust. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
656eb2cd5d
commit
293adee601
@@ -171,12 +171,11 @@ EXPORT_SYMBOL(kthread_create);
|
|||||||
*/
|
*/
|
||||||
void kthread_bind(struct task_struct *k, unsigned int cpu)
|
void kthread_bind(struct task_struct *k, unsigned int cpu)
|
||||||
{
|
{
|
||||||
if (k->state != TASK_UNINTERRUPTIBLE) {
|
/* Must have done schedule() in kthread() before we set_task_cpu */
|
||||||
|
if (!wait_task_inactive(k, TASK_UNINTERRUPTIBLE)) {
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Must have done schedule() in kthread() before we set_task_cpu */
|
|
||||||
wait_task_inactive(k, 0);
|
|
||||||
set_task_cpu(k, cpu);
|
set_task_cpu(k, cpu);
|
||||||
k->cpus_allowed = cpumask_of_cpu(cpu);
|
k->cpus_allowed = cpumask_of_cpu(cpu);
|
||||||
k->rt.nr_cpus_allowed = 1;
|
k->rt.nr_cpus_allowed = 1;
|
||||||
|
Reference in New Issue
Block a user