How to detect multi-core and/or HT-enabled CPUs in 2.4.x and 2.6.x kernels

From: Martin Knoblauch
Date: Wed Dec 27 2006 - 09:21:11 EST

Hi, (please CC on replies, thanks)

for the ganglia project ( we are
trying to find a heuristics to determine the number of physical CPU
"cores" as opposed to virtual processors added by enabling HT. The
method should work on 2.4 and 2.6 kernels.

So far it seems that looking at the "physical id", "core id" and "cpu
cores" of /proc/cpuinfo is the way to go.

In 2.6 I would try to find the distinct "physical id"s and and sum
up the corresponding "cpu cores". The question is whether this would
work for 2.4 based systems.

Does anybody recall when the "physical id", "core id" and "cpu cores"
were added to /proc/cpuinfo ?


Martin Knoblauch
email: k n o b i AT knobisoft DOT de
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at