MINOR: cpu-topo: skip CPU detection when /sys/.../cpu does not exist
There's no point scanning all entries when /cpu doesn't exist in the first place. Let's check once for it and skip the loop in this case.
This commit is contained in:
parent
c5ddf4a5b2
commit
8542c79f9d
@ -259,6 +259,10 @@ int cpu_detect_topology(void)
|
|||||||
* thread_set_id, cluster_id, l1/l2/l3 id, etc. We don't revisit entries
|
* thread_set_id, cluster_id, l1/l2/l3 id, etc. We don't revisit entries
|
||||||
* already filled from the list provided by another CPU.
|
* already filled from the list provided by another CPU.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!is_dir_present(NUMA_DETECT_SYSTEM_SYSFS_PATH "/cpu"))
|
||||||
|
goto skip_cpu;
|
||||||
|
|
||||||
for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
|
for (cpu = 0; cpu <= cpu_topo_lastcpu; cpu++) {
|
||||||
struct hap_cpuset cpus_list;
|
struct hap_cpuset cpus_list;
|
||||||
int next_level = 1; // assume L1 if unknown
|
int next_level = 1; // assume L1 if unknown
|
||||||
@ -442,6 +446,7 @@ int cpu_detect_topology(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip_cpu:
|
||||||
/* Now locate NUMA node IDs if any */
|
/* Now locate NUMA node IDs if any */
|
||||||
|
|
||||||
dir = opendir(NUMA_DETECT_SYSTEM_SYSFS_PATH "/node");
|
dir = opendir(NUMA_DETECT_SYSTEM_SYSFS_PATH "/node");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user