Messages in this thread | | | Date | Sat, 28 Jan 2006 12:06:20 -0800 | From | Paul Jackson <> | Subject | Re: 2.6.16 - sys_sched_getaffinity & hotplug |
| |
Nathan wrote: > Task finishes work and does sched_setaffinity(saved_mask).
Stupid task. If task wants to run on -all- cpus on a hotplug system, task should not pass a saved mask, but rather construct a mask with all bits set and pass that:
cpu_set_t mask; unsigned int i;
/* set all bits in mask - code totally untested */ for (i = 0; i < sizeof(cpu_set_t) / sizeof (__cpu_mask); i++) mask.__bits[i] = ~0;
sched_setaffinity(&mask);
Similar problems exist for a task running in a cpuset under migration. Saved masks are useless in all but static systems, having no migration, no hotplug.
That, or use a library on top of this that lets the task work with relative (to whatever is available) CPU and (for the mbind/mempolicy calls) Memory Node numbers and that handles the above details. If all goes well, I should be releasing such a library in the not distant future.
-- I won't rest till it's the best ... Programmer, Linux Scalability Paul Jackson <pj@sgi.com> 1.925.600.0401 - 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/
| |