Re: getcpu after sched_setaffinity

From: Ulrich Drepper
Date: Thu May 10 2007 - 19:09:38 EST


Andi Kleen wrote:
Probably. In principle getcpu() (where does the sched_ come from btw?)

getcpu() is an unacceptable name. All te other functions dealing with CPU (sets, etc) have a sched_ prefix.


is only designed for the case where you don't set the affinity explicitely;
otherwise you should already know where you are and don't need it.

That's not true in general. Yes, because I want to test vgetcpu() I restrict the set to just one CPU.

But if I have more than 2 "CPUs" and I set the affinity to two CPUs which currently are not used you cannot make this argument.

getcpu should always work correctly not only if you cannot determine it in another way.


Hmm ok one could probably define memset(..., 0) as a invalidation
interface, but because of the considerations above i don't think
it is really needed.

It is needed.

For now I added the cache clearing in the setaffinity calls in libc. Resetting to cache to {0,0} seems to work.

--
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â
-
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/