Re: getcpu after sched_setaffinity

From: Andi Kleen
Date: Fri May 11 2007 - 02:11:46 EST


On Thu, May 10, 2007 at 04:09:10PM -0700, Ulrich Drepper wrote:
> >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.

All the users I talked to never mentioned this as a use case.
They were only interested in fully unrestricted programs.

Anyways you can handle it too, just invalidate or do getcpu with
a new cache afterwards.

Or just wait the jiffie for the cache to expire.

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

getcpu by design is approximate. If you don't understand this
don't bother using it.

-Andi

-
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/