kthread_bind: use wait_task_inactive(TASK_UNINTERRUPTIBLE)
Changes
1 files changed · +2 −3
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| kernel/kthread.c | modified | +2 | −3 | View file |
kernel/kthread.c
View filediff --git a/kernel/kthread.c b/kernel/kthread.c
index 96cff2f..14ec64f 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -171,12 +171,11 @@ EXPORT_SYMBOL(kthread_create);
*/
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);
return;
}
- /* Must have done schedule() in kthread() before we set_task_cpu */
- wait_task_inactive(k, 0);
set_task_cpu(k, cpu);
k->cpus_allowed = cpumask_of_cpu(cpu);
k->rt.nr_cpus_allowed = 1;