lkml.org 
[lkml]   [2006]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.16 - sys_sched_getaffinity & hotplug
Paul Jackson 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);
>
> Adding Robert Love to the cc list, as he is Mr. sched_getaffinity,
> I believe.
>
> I ended up doing a similar change, to the cpus (and mems) masks
> in the root (all encompassing) cpuset.

Which is problematic, because cpuset_cpus_allowed ->
guarantee_online_cpus restricts the task->cpus_allowed mask to cpus
which happen to be online at the time of the call to
sched_setaffinity. If more cpus come online later, that task can't be
migrated to them.

> These now show the values
> of cpu_online_map and node_online_map, not *_MASK_ALL.
>
> My hunches are:
> * This change to cpu_online_map is a good one.

It's not.

> * The man page sentence "Usually, all bits in the mask are set."
> might have meant something when it was written, but it is not
> now clear what.

I think it could reasonably be interpreted as all bits in the mask are
set unless the task's affinity has been modified.
-
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/

\
 
 \ /
  Last update: 2006-01-28 04:45    [W:0.265 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site