Re: getting processor numbers

Ulrich Drepper
2007-04-03T17:45:57Z

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

Andi Kleen wrote:
>>> Topology is dependent on the number of CPUs.
>> Not all of it.
>
> What is not?

Memory banks can exist without a CPU present. The places where you can
plug in memory don't change and so the memory hierarchy can be described.

> Hmm, e.g. in OpenMP you would have another thread that just reads /proc/cpuinfo
> in a loop and starts new threads on new CPUs?
>
> That sounds ...... "expensive"

That's the cost of doing business.

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.
This page (read-only at userlevel) would contain global information such
as processor count and topology.

But we're getting IMO off topic here. That's a separate and far more
complicated issue.

Here we now have the concrete issue that determining the CPU count is
terribly expensive and there is a simple proposal to make it faster by
keeping /sys/devices/system/cpu/ free from anything but cpu* directories.

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

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