Re: getting processor numbers

Ulrich Drepper
2007-04-03T18:06:04Z

[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

Andi Kleen wrote:
>> There is an inexpensive solution: finally make the vdso concept a bit
>> more flexible. You could add a vdso call to get the processor count.
>> The vdso code itself can use a data page mapped in from the kernel.
>
> The ELF aux vector is exactly that already.

No. The aux vector cannot be changed after the process is changed. The
memory belong to the process and not the kernel. It must be possible at
any time to get the correct information even if the system changed.

>> This page (read-only at userlevel) would contain global information such
>> as processor count and topology.
>
> You would still need an event notification mechanism, won't you?

No, why? The vdso call would be so inexpensive (just a simple function
call) that it can be done whenever a topology-based decision has to be
made. Use cookies to determine whether nothing has been changed since
the last call etc.

> The cost will be still large. Accessing sysfs will be never cheap.
> For once anything going through the VFS tens to take a two sometimes
> three digit number of locks.

That stat solution actually ain't that bad. It takes ~7400 cycles on my
machine.

> If you want it cheap look for some other way.

Well, who's brace enough to submit sys_sysconf() again?

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]