/proc/cpuinfo format - arch dependent!
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 13 lines · Stefan Smietanowski
Quoted 8 lines
I personally think that what would be useful is not "the number of CPUs" (which does not make any sense), but an enumeration of :
- the physical nodes (for NUMA)
- the physical CPUs
- each CPU's cores (for multi-core)
- each core's siblings (for HT/SMT)Quoted 4 lines
each of which would report their respective id for {set,get}_affinity(). This way, the application would be able to choose how it needs to spread over available CPUs depending on its workload. But IMHO, this should definitely not be put in cpuinfo. I consider that cpuinfo is for the human.
Quoted 5 lines
When one defines it one way you can be sure there'll come some company and figure something out that doesn't fit into that representation.
Like - Stick a board into the CPU slot of some motherboard. That board has two DualCore, SMT chips.
Obviously it must be a tree of CPU groups. CPUs in one NUMA node go into one group, multi-core CPUs have all cores in one group and HT is a group, too. This will scale from UP (degenerated tree with just one CPU) to clusters with multicore HT-capable CPUs on PCI boards.
e.g. if you choose to represent it as a string:
Object = <Offline-Indicator>? (<CPU>|<Group>) <Details>?
Offline-Indicator = "-"
CPU = qr/[a-z0-9_]+/ # or more restrictive
Group = "[" (<Object>)("," <Object>)* "]"
Details = "{" (<vardef)("," <Vardef>)* "}"
Vardef = <Key> "=" <Value> # or "=>" if you think perl
Key = qr/[a-z0-9_]+/
Value = qr/"([^"\000]|"")*"/The described board in a UP system might look like:
[cpu0{speed="4.77MHz", RAM="80KB"},
[[[boardcpu0_0, boardcpu0_0_ht]{group="ht"},
[boardcpu0_1, boardcpu0_1_ht]{group="ht"}],
[[boardcpu1_0, boardcpu1_0_ht]{group="ht"},
[boardcpu1_1, boardcpu1_1_ht]{group="ht"}]{group="numa",RAM="4GB"}]
To count them, do:
#/usr/bin/perl
s/"[^"]*"//g;
s/\{[^}]*\}//g;
$numcpus=s/,/,/g + 1;
Signature · 2 lines
Top 100 things you don't want the sysadmin to say: 43. The backup procedure works fine, but the restore is tricky!
Quoted 5 lines · "Bodo Eggert <[email protected]>" <[email protected]>…
Obviously it must be a tree of CPU groups. CPUs in one NUMA node go into one group, multi-core CPUs have all cores in one group and HT is a group, too. This will scale from UP (degenerated tree with just one CPU) to clusters with multicore HT-capable CPUs on PCI boards.
All this informtation (except HT/multicore are folded into a single level) is already there in sysfs.
libnuma uses it to discover the topology and report it to the user.
-Andi