Hi Anton, Thanks for the fix. I've started a version 2.0.4 at ftp://oss.sgi.com/www/projects/libnuma/download/ and this is the first patch in it. -Cliff > Date: Thu, 20 Aug 2009 10:10:34 +1000 > From: Anton Blanchard <anton@xxxxxxxxx> > To: linux-numa@xxxxxxxxxxxxxxx > Subject: [PATCH] libnuma: Fix issue with numactl --hardware on sparse cpumaps > > Hi, > > On a machine with sparse cpu ids, numactl fails to print the right cpus: > > # numactl --hardware | grep cpus > node 0 cpus: 0 2 4 6 > node 1 cpus: > > It turns out we were iterating through 0..nr_cpus, not 0..max_cpuid. The > following patch fixes it by using a cpumask instead of an open coded bitmask, > and looping from 0 to the size of the cpumask. > > # numactl --hardware | grep cpus > node 0 cpus: 0 2 4 6 > node 1 cpus: 8 10 12 14 > > Signed-off-by: Anton Blanchard <anton@xxxxxxxxx> > --- > > diff -ru numactl-2.0.3~/numactl.c numactl-2.0.3/numactl.c > --- numactl-2.0.3~/numactl.c 2009-06-10 07:30:03.000000000 -0500 > +++ numactl-2.0.3/numactl.c 2009-08-19 18:57:10.064311316 -0500 > @@ -200,14 +200,13 @@ > > void print_node_cpus(int node) > { > - int conf_cpus = numa_num_configured_cpus(); > int i, err; > struct bitmask *cpus; > > - cpus = numa_bitmask_alloc(conf_cpus); > + cpus = numa_allocate_cpumask(); > err = numa_node_to_cpus(node, cpus); > if (err >= 0) > - for (i = 0; i < conf_cpus; i++) > + for (i = 0; i < cpus->size; i++) > if (numa_bitmask_isbitset(cpus, i)) > printf(" %d", i); > putchar('\n'); > > -- Cliff Wickman SGI cpw@xxxxxxx (651) 683-3824 -- 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