What if instead of visiting each cpu individually, you visit by numa node and only consider thread grouping inside a numa node? Then you could go back to the old datastructure. You could also fall back to visiting by cpu directly if the node interface doesn't exist: user@host:~# ls -salh /sys/devices/system/node/node*/cpu* 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu0 -> ../../cpu/cpu0 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu1 -> ../../cpu/cpu1 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu2 -> ../../cpu/cpu2 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu3 -> ../../cpu/cpu3 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu4 -> ../../cpu/cpu4 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu5 -> ../../cpu/cpu5 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu6 -> ../../cpu/cpu6 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node0/cpu7 -> ../../cpu/cpu7 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node0/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node0/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu10 -> ../../cpu/cpu10 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu11 -> ../../cpu/cpu11 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu12 -> ../../cpu/cpu12 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu13 -> ../../cpu/cpu13 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu14 -> ../../cpu/cpu14 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu15 -> ../../cpu/cpu15 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu8 -> ../../cpu/cpu8 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node1/cpu9 -> ../../cpu/cpu9 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node1/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node1/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu16 -> ../../cpu/cpu16 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu17 -> ../../cpu/cpu17 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu18 -> ../../cpu/cpu18 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu19 -> ../../cpu/cpu19 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu20 -> ../../cpu/cpu20 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu21 -> ../../cpu/cpu21 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu22 -> ../../cpu/cpu22 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node2/cpu23 -> ../../cpu/cpu23 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node2/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node2/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu24 -> ../../cpu/cpu24 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu25 -> ../../cpu/cpu25 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu26 -> ../../cpu/cpu26 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu27 -> ../../cpu/cpu27 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu28 -> ../../cpu/cpu28 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu29 -> ../../cpu/cpu29 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu30 -> ../../cpu/cpu30 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node3/cpu31 -> ../../cpu/cpu31 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node3/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node3/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu32 -> ../../cpu/cpu32 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu33 -> ../../cpu/cpu33 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu34 -> ../../cpu/cpu34 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu35 -> ../../cpu/cpu35 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu36 -> ../../cpu/cpu36 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu37 -> ../../cpu/cpu37 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu38 -> ../../cpu/cpu38 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node4/cpu39 -> ../../cpu/cpu39 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node4/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node4/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu40 -> ../../cpu/cpu40 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu41 -> ../../cpu/cpu41 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu42 -> ../../cpu/cpu42 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu43 -> ../../cpu/cpu43 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu44 -> ../../cpu/cpu44 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu45 -> ../../cpu/cpu45 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu46 -> ../../cpu/cpu46 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node5/cpu47 -> ../../cpu/cpu47 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node5/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node5/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu48 -> ../../cpu/cpu48 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu49 -> ../../cpu/cpu49 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu50 -> ../../cpu/cpu50 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu51 -> ../../cpu/cpu51 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu52 -> ../../cpu/cpu52 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu53 -> ../../cpu/cpu53 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu54 -> ../../cpu/cpu54 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node6/cpu55 -> ../../cpu/cpu55 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node6/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node6/cpumap 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu56 -> ../../cpu/cpu56 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu57 -> ../../cpu/cpu57 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu58 -> ../../cpu/cpu58 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu59 -> ../../cpu/cpu59 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu60 -> ../../cpu/cpu60 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu61 -> ../../cpu/cpu61 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu62 -> ../../cpu/cpu62 0 lrwxrwxrwx 1 root root 0 Apr 2 01:10 /sys/devices/system/node/node7/cpu63 -> ../../cpu/cpu63 0 -r--r--r-- 1 root root 4.0K Apr 2 01:10 /sys/devices/system/node/node7/cpulist 0 -r--r--r-- 1 root root 4.0K Apr 2 00:42 /sys/devices/system/node/node7/cpumap