Re: 3 ways to represent cpu affinity in /sys and counting

From: Andi Kleen
Date: Mon Jan 03 2005 - 10:18:35 EST


On Sun, Dec 26, 2004 at 11:27:44AM +1100, Anton Blanchard wrote:
>
> A pci device has a local_cpus property:
>
> /sys/devices/pci000a:00/000a:00:02.6/local_cpus

We should have both node and cpus here because both
are needed in user space (one for CPU affinity, the other
for memory affinity). While it's possible to convert
in user space it's quite cumbersome.

I plan to add functions to libnuma to make this easy,
but I'm not sure everybody will want to use libnuma just
for this.

>
> A pci_bus has a cpuaffinity property:
>
> /sys/class/pci_bus/000d:d8/cpuaffinity

I'm not sure what that is anyways. I don't think x86-64 sets it up
and does anybody really use it?
>
> A node has a cpumap property:
>
> /sys/devices/system/node/node3/cpumap
>
> Can we standardize on a single property name for this? :)

I suspect it's already too late.

>
> Furthermore, looking at node linkages:
>
> A node has symlinks to cpus:
>
> /sys/devices/system/node/node0/cpu0 -> /sys/devices/system/cpu/cpu0
>
> But doesnt have symlinks to pci devices.

I'm not sure how useful that would be anyways.

>
> A cpu doesnt have a cpumask of its node, but a pci device and pci bus
> both do. Is there some way we can stardardize this too?

You mean a nodemask?

>
> Ideally we want to be able to lookup a device -> node -> cpumask
> relationship in a consistent way. Assuming we fix up the 3 different
> names for cpu affinity properties, we still have 2 methods of looking
> that up, and no easy way of going from pci devices to nodes.

You mean the user space interface?

Getting it from sysfs will be always a mess, best is to have a standard
library that offers this in nice functions and a command whose output
can be parsed by shell scripts. I plan to add this eventually to
numactl/libnuma.

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