On Wed, 17 Sep 2014, Ganapatrao Kulkarni wrote: > yes, one more bug(likely), if no nodes, this function should return > -1, but it returns 0. > for no nodes case, if function returns -1, then +1 makes sense for all cases. > --- libnuma.c.orig 2014-09-17 08:58:21.119671188 +0530 > +++ libnuma.c 2014-09-17 08:59:14.731333190 +0530 > @@ -330,7 +330,7 @@ > > d = opendir("/sys/devices/system/node"); > if (!d) { > - maxconfigurednode = 0; > + maxconfigurednode = -1; > } else { > while ((de = readdir(d)) != NULL) { > int nd; > It would probably be helpful to just create a new num_nodes() function and comment all this so it's clear. There's also the possibility of memoryless nodes on both powerpc and x86, so if the context is strictly counting nodes that include memory, a num_mem_nodes() function would also be helpful. -- To unsubscribe from this list: send the line "unsubscribe linux-numa" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html