microfetch
microfetch copied to clipboard
Topology counts P/E threads as cores and reports a phantom E-core on non-hybrid Alder Lake
On an i5-12400F (6 P-cores, 0 E-cores, 12 threads) the Topology line reads:
Topology 6 cores (12p/1e), 12 threads
Expected: 6 cores, 12 threads (or 6p/0e). Two causes in crates/lib/src/cpu.rs:
/sys/devices/cpu_core/cpusand/sys/devices/cpu_atom/cpuslist logical CPUs, not cores.get_pe_corescounts the entries directly, so SMT doubles the P count. On this box the file holds0-11.- Alder Lake parts with the E-cores fused off still register the atom PMU, but its cpulist is empty (just
\n).count_cpulistparses no digits, counts one entry anyway, then skips the newline, giving a phantom E-core.
Any 12th gen+ Intel without E-cores (12400, 12500, non-K 12600) hits both. Parts with E-cores get an inflated P count only.
$ od -c /sys/devices/cpu_atom/cpus
0000000 \n
$ cat /sys/devices/cpu_core/cpus
0-11
$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
0-1
microfetch 1.1.0 from nixpkgs, kernel 7.2.8. Same code on main. PR incoming.