Re: 2.6.16 - sys_sched_getaffinity & hotplug

From: Paul Jackson
Date: Sat Jan 28 2006 - 01:58:37 EST


Nathan, responding to pj, responding to Nathan:
> > Nathan wrote:
> > > 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.
> >
> > Well, sort of.
> >
> > A task could always migrate - just because a sched_getaffinity
> > the task did in the past doesn't show a CPU as valid, doesn't stop
> > the task from asking to pin to that CPU now.
>
> I was speaking of the setaffinity (not getaffinity) case -- I assumed
> this was what you were referring to since I couldn't find any calls to
> the cpuset code in the getaffinity path.


Oh dear ... and you said 'setaffinity' quite clearly. Though
Jack's original post only dealt with getaffinity.

I think this discussion is getting quite confused, for which
I can take at least some of the credit.

You observe, correctly, that the call chain:
sched_setaffinity
cpuset_cpus_allowed
guarantee_online_cpus
restricts a sched_setaffinity to CPUs online at the time of that
sched_setaffinity call.

However, I have no clue how you conclude from this that "If more cpus
come online later, that task can't be migrated to them."

At anytime that some system service or batch scheduler wants to
migrate a task to some different CPUs (whether or not those CPUs were
once offline), it can either attach that task to a different cpuset,
or change the 'cpus' of its current cpuset.

Then if it wants to properly keep that tasks placement relative to its
new cpuset, it can reissue a sched_setaffinity on that tasks behalf,
to again set that tasks cpus_allowed to the same, relative to the
containing cpuset, CPUs as before.

Nothing in the behaviour of sched_getaffinity, that Jack was
considering, nor in the behaviour of sched_setaffinity, that
you thought I must be considering, has any impact on which CPUs
a task can be migrated to.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.925.600.0401
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/