Commit 3ccd5369 authored by Robert Love's avatar Robert Love Committed by Linus Torvalds

[PATCH] hyper-threading info in /proc/cpuinfo

This adds hyper-threading information to /proc/cpuinfo, if relevant: the
physical processor id and the number of sibling units in this core.

The naming of the fields were debated a bit on lkml and the names below
offend the least number of people, do not break glibc, and are the same
as those in 2.4-ac.

This is in 2.4-ac, 2.5-mm, and vendor kernels from RedHat, SuSE, etc.
parent 14029c7b
...@@ -17,6 +17,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -17,6 +17,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
* applications want to get the raw CPUID data, they should access * applications want to get the raw CPUID data, they should access
* /dev/cpu/<cpu_nr>/cpuid instead. * /dev/cpu/<cpu_nr>/cpuid instead.
*/ */
extern int phys_proc_id[NR_CPUS];
static char *x86_cap_flags[] = { static char *x86_cap_flags[] = {
/* Intel-defined */ /* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
...@@ -74,6 +75,12 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -74,6 +75,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
/* Cache size */ /* Cache size */
if (c->x86_cache_size >= 0) if (c->x86_cache_size >= 0)
seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
#ifdef CONFIG_SMP
if (cpu_has_ht) {
seq_printf(m, "physical id\t: %d\n", phys_proc_id[n]);
seq_printf(m, "siblings\t: %d\n", smp_num_siblings);
}
#endif
/* We use exception 16 if we have hardware math and we've either seen it or the CPU claims it is internal */ /* We use exception 16 if we have hardware math and we've either seen it or the CPU claims it is internal */
fpu_exception = c->hard_math && (ignore_irq13 || cpu_has_fpu); fpu_exception = c->hard_math && (ignore_irq13 || cpu_has_fpu);
......
...@@ -58,7 +58,7 @@ static int __initdata smp_b_stepping; ...@@ -58,7 +58,7 @@ static int __initdata smp_b_stepping;
/* Number of siblings per CPU package */ /* Number of siblings per CPU package */
int smp_num_siblings = 1; int smp_num_siblings = 1;
int __initdata phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */ int phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */
/* Bitmask of currently online CPUs */ /* Bitmask of currently online CPUs */
unsigned long cpu_online_map; unsigned long cpu_online_map;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment