Hi Ingo,
the function set_cpus_allowed(task_t *p, unsigned long new_mask)
works "as is" only if called for the task p=current. The appended patch
corrects this and enables e.g. external load balancers to change the
cpus_allowed mask of an arbitrary process.
BTW: how about migrating the definition of the structures runqueue and
prio_array into include/linux/sched.h and exporting the symbol
runqueues? It would help with debugging, monitoring and other
developments.
Thanks,
Best regards,
Erich
--- 2.4.17-IA64-kdb-J9/kernel/sched.c Thu Jan 31 18:39:37 2002
+++ 2.4.17-IA64-kdb-J9ia64/kernel/sched.c Fri Feb 1 16:06:40 2002
@@ -859,16 +868,16 @@
p->cpus_allowed = new_mask;
/*
- * Can the task run on the current CPU? If not then
+ * Can the task run on its current CPU? If not then
* migrate the process off to a proper CPU.
*/
- if (new_mask & (1UL << smp_processor_id()))
+ if (new_mask & (1UL << p->cpu))
return;
#if CONFIG_SMP
- current->state = TASK_UNINTERRUPTIBLE;
- smp_migrate_task(__ffs(new_mask), current);
-
- schedule();
+ p->state = TASK_UNINTERRUPTIBLE;
+ smp_migrate_task(__ffs(new_mask), p);
+ if (p == current)
+ schedule();
#endif
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Feb 07 2002 - 21:00:14 EST