Patch: numactl-ignore-nonavailable-nodes.patch This patch fixes the problem of displaying wrong number of "available" nodes. It also ignores non-existent nodes and thus avoids the wrong warning message also. Signed-off-by: Amit K Arora <aarora@xxxxxxxxxxxxxxxxxx> diff -Nuarp numactl-2.0.3-rc2.ORG/libnuma.c numactl-2.0.3-rc2/libnuma.c --- numactl-2.0.3-rc2.ORG/libnuma.c 2009-03-02 05:10:10.000000000 -0600 +++ numactl-2.0.3-rc2/libnuma.c 2009-03-02 05:11:01.000000000 -0600 @@ -54,6 +54,8 @@ struct bitmask *numa_all_cpus_ptr = NULL static unsigned long *node_cpu_mask_v1[NUMA_NUM_NODES]; struct bitmask **node_cpu_mask_v2; +char *nodes_allowed_list = NULL; + WEAK void numa_error(char *where); #ifdef __thread @@ -452,6 +454,12 @@ set_thread_constraints(void) maxprocnode = read_mask(buffer + 15, numa_all_nodes_ptr); } + if (strncmp(buffer,"Mems_allowed_list:",18) == 0) { + nodes_allowed_list = malloc(strlen(buffer)-18); + strncpy(nodes_allowed_list, buffer + 19, + strlen(buffer) - 19); + nodes_allowed_list[strlen(nodes_allowed_list)-1] = '\0'; + } } fclose(f); free(buffer); diff -Nuarp numactl-2.0.3-rc2.ORG/numactl.c numactl-2.0.3-rc2/numactl.c --- numactl-2.0.3-rc2.ORG/numactl.c 2009-03-02 05:10:10.000000000 -0600 +++ numactl-2.0.3-rc2/numactl.c 2009-03-02 05:11:01.000000000 -0600 @@ -214,13 +214,24 @@ void print_node_cpus(int node) void hardware(void) { - int i; + int i, numconfigurednodes=0; int maxnode = numa_num_configured_nodes()-1; - printf("available: %d nodes (0-%d)\n", 1+maxnode, maxnode); + + for (i = 0; i<=maxnode; i++) + if (numa_bitmask_isbitset(numa_all_nodes_ptr, i)) + numconfigurednodes++; + if (nodes_allowed_list) + printf("available: %d nodes (%s)\n", numconfigurednodes, nodes_allowed_list); + else + printf("available: %d nodes (0-%d)\n", maxnode+1, maxnode); + for (i = 0; i <= maxnode; i++) { char buf[64]; long long fr; unsigned long long sz = numa_node_size64(i, &fr); + if (!numa_bitmask_isbitset(numa_all_nodes_ptr, i)) + continue; + printf("node %d cpus:", i); print_node_cpus(i); printf("node %d size: %s\n", i, fmt_mem(sz, buf)); diff -Nuarp numactl-2.0.3-rc2.ORG/numa.h numactl-2.0.3-rc2/numa.h --- numactl-2.0.3-rc2.ORG/numa.h 2009-03-02 05:10:10.000000000 -0600 +++ numactl-2.0.3-rc2/numa.h 2009-03-02 05:11:01.000000000 -0600 @@ -161,6 +161,8 @@ extern struct bitmask *numa_no_nodes_ptr /* Source compatibility */ extern nodemask_t numa_no_nodes; +extern char *nodes_allowed_list; + /* Only run and allocate memory from a specific set of nodes. */ void numa_bind(struct bitmask *nodes); diff -Nuarp numactl-2.0.3-rc2.ORG/versions.ldscript numactl-2.0.3-rc2/versions.ldscript --- numactl-2.0.3-rc2.ORG/versions.ldscript 2009-03-02 05:10:10.000000000 -0600 +++ numactl-2.0.3-rc2/versions.ldscript 2009-03-02 05:11:01.000000000 -0600 @@ -143,6 +143,7 @@ libnuma_1.2 { numa_tonode_memory; numa_tonodemask_memory; numa_warn; + nodes_allowed_list; local: *; } libnuma_1.1; -- Regards, Amit Arora -- 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