--- linux-2.6.10/arch/x86_64/kernel/setup.c 2005-01-10 12:26:21.414190368 -0800 +++ linux-2.6.10.new.x86_64/arch/x86_64/kernel/setup.c 2005-01-10 12:30:53.656803200 -0800 @@ -738,7 +738,6 @@ { #ifdef CONFIG_SMP u32 eax, ebx, ecx, edx; - int index_lsb, index_msb, tmp; int cpu = smp_processor_id(); if (!cpu_has(c, X86_FEATURE_HT)) @@ -750,8 +749,6 @@ if (smp_num_siblings == 1) { printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); } else if (smp_num_siblings > 1) { - index_lsb = 0; - index_msb = 31; /* * At this point we only support two siblings per * processor package. @@ -761,19 +758,8 @@ smp_num_siblings = 1; return; } - tmp = smp_num_siblings; - while ((tmp & 1) == 0) { - tmp >>=1 ; - index_lsb++; - } - tmp = smp_num_siblings; - while ((tmp & 0x80000000 ) == 0) { - tmp <<=1 ; - index_msb--; - } - if (index_lsb != index_msb ) - index_msb++; - phys_proc_id[cpu] = phys_pkg_id(index_msb); + + phys_proc_id[cpu] = c->x86_apicid >> hweight32(c->x86_num_cores - 1); printk(KERN_INFO "CPU: Physical Processor ID: %d\n", phys_proc_id[cpu]);