10 Mar 2010 18:10
numa_num_configured_cpus off by 2 on 2.6.33 ?
Martin Vogt <martin.vogt <at> itwm.fraunhofer.de>
2010-03-10 17:10:43 GMT
2010-03-10 17:10:43 GMT
Hello list,
currently my numa library reports two cpus more than I actuall have:
nCPUs=numa_num_configured_cpus();
printf("Currently available CPUs: %d\n",nCPUs);
Currently available CPUs: 34 (but it has only 32)
looking in the source:
static void
set_configured_cpus(void)
{
int filecount=0;
char *dirnamep = "/sys/devices/system/cpu";
struct dirent *dirent;
DIR *dir;
dir = opendir(dirnamep);
if (dir == NULL) {
/* fall back to using the online cpu count */
maxconfiguredcpu = sysconf(_SC_NPROCESSORS_CONF) - 1;
return;
}
while ((dirent = readdir(dir)) != 0) {
if (!strncmp("cpu", dirent->d_name, 3)) {
filecount++;
} else {
continue;
}
}
closedir(dir);
maxconfiguredcpu = filecount-1; /* high cpu number */
return;
}
Makes the error clear. On kernel 2.6.33 I have:
cpu0/ cpu21/ cpu6/
cpu1/ cpu22/ cpu7/
cpu10/ cpu23/ cpu8/
cpu11/ cpu24/ cpu9/
cpu12/ cpu25/ cpufreq/ <------- Here
cpu13/ cpu26/ cpuidle/ <------- Here
cpu14/ cpu27/ kernel_max
cpu15/ cpu28/ offline
cpu16/ cpu29/ online
cpu17/ cpu3/ perf_events/
cpu18/ cpu30/ possible
cpu19/ cpu31/ present
cpu2/ cpu4/ sched_mc_power_savings
cpu20/ cpu5/
I think it counts "cpufreq" and "cpuidle" too.
I'm using numactl-2.0.4-rc2, is there a version where the bug
(I assume its a bug) is already corrected in a patch?
regards,
Martin
RSS Feed