Messages in this thread |  | | | Date | Sat, 28 Jan 2006 13:27:36 -0600 | | From | Nathan Lynch <> | | Subject | Re: 2.6.16 - sys_sched_getaffinity & hotplug |
| |
Ingo Molnar wrote: > > > Jack wrote: > > > Should the following change be made to sched_getaffinity(). > > > > > > Index: linux/kernel/sched.c > > > =================================================================== > > > --- linux.orig/kernel/sched.c 2006-01-25 08:50:21.401747695 -0600 > > > +++ linux/kernel/sched.c 2006-01-27 16:57:24.504871895 -0600 > > > @@ -4031,7 +4031,7 @@ long sched_getaffinity(pid_t pid, cpumas > > > goto out_unlock; > > > > > > retval = 0; > > > - cpus_and(*mask, p->cpus_allowed, cpu_possible_map); > > > + cpus_and(*mask, p->cpus_allowed, cpu_online_map); > > > In any case, Jack's change looks reasonable and obviously correct.
Are you sure? Assuming this change is in effect, consider the following:
Task starts with default affinity.
Task does sched_getaffinity, stashes the result in saved_mask.
Task pins itself to one cpu and does some work.
Meanwhile, more cpus are brought online.
Task finishes work and does sched_setaffinity(saved_mask).
Task will never run on the new cpus.
- 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/
|  |