Hello community,
here is the log from the commit of package numactl for openSUSE:Factory
checked in at Wed Dec 16 16:11:05 CET 2009.
--------
--- numactl/numactl.changes 2009-12-10 13:37:12.000000000 +0100
+++ /mounts/work_src_done/STABLE/numactl/numactl.changes 2009-12-11 14:19:34.000000000 +0100
@@ -1,0 +2,6 @@
+Fri Dec 11 14:18:35 CET 2009 - trenn@suse.de
+
+- Update to version 2.0.4-rc1
+- Added missing manpages: numastat, migspeed, migratepages
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
numactl-2.0.3-rc1.tar.bz2
numactl-fixasneeded.patch
numactl-hardware-bits_per_long_cpus.diff
New:
----
numactl-2.0.4-rc1.tar.bz2
numactl_install_all_manpages
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ numactl.spec ++++++
--- /var/tmp/diff_new_pack.BffDm6/_old 2009-12-16 16:09:51.000000000 +0100
+++ /var/tmp/diff_new_pack.BffDm6/_new 2009-12-16 16:09:51.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package numactl (Version 2.0.2_2.0.3rc1)
+# spec file for package numactl (Version 2.0.4.rc1)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -22,9 +22,9 @@
Name: numactl
License: GPLv2 ; GPLv2+
Summary: NUMA Policy Control
-Version: 2.0.2_2.0.3rc1
-Release: 5
-%define origversion 2.0.3-rc1
+Version: 2.0.4.rc1
+Release: 1
+%define origversion 2.0.4-rc1
AutoReqProv: on
# bug437293
%ifarch ppc64
@@ -32,8 +32,7 @@
%endif
#
Source: numactl-%{origversion}.tar.bz2
-Patch0: numactl-hardware-bits_per_long_cpus.diff
-Patch1: numactl-fixasneeded.patch
+Patch0: numactl_install_all_manpages
Group: System/Management
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: ia64 x86_64 ppc64 ppc
@@ -88,7 +87,6 @@
%prep
%setup -n %{name}-%{origversion}
%patch0 -p1
-%patch1 -p1
%build
make CFLAGS="${RPM_OPT_FLAGS}"
++++++ numactl-2.0.3-rc1.tar.bz2 -> numactl-2.0.4-rc1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/CHANGES new/numactl-2.0.4-rc1/CHANGES
--- old/numactl-2.0.3-rc1/CHANGES 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/CHANGES 2009-08-31 14:37:13.000000000 +0200
@@ -270,12 +270,32 @@
- Fixes to numademo (min/max, and array index; from Kent Liu)
- Fixes to Makefile and permissions; from Berhard Walle
-2.0.3-rc1
+2.0.3-rc1 - rc3
- Fixes to libnuma.c numa.h numacompat1.h by Daniel Gollub to fix v1 compatiblity
-- Fixes for 64-bit big-endian systems (seen by Arnd Bergmann and Mijo Safradin)
- Restore nodemask_zero() and nodemask_equal()
-- Fixes to read_mask()
- Drops a warning message about this not being a NUMA system
- Remove the numa_maps.5 man page (it's in Linux now) (by Bernhard Walle)
- Fix makefiles in tests (Andi)
- Fix off-by-ones in test mbind_mig_pages (Andi)
+- Fix test/prefered.c (Andi)
+- Fix to print_node_cpus() (Arnd/Bill Buros)
+- Fixes to read_mask() (Arnd's on top of cpw's)
+- Fix to makefile (LDFLAGS/LDLIBS/AR/RANLIB) (Mike Frysinger)
+- Fix numactl for noncontiguous nodes (Amit Arora)
+- Fix bitmask memory leaks, numa_alloc_onnode/numa_preferred (Kornilios Kourtis)
+- Add numa_node_of_cpu() to retrieve local node of a cpu (Kornilios Kourtis)
+- Fix parsing of /proc/self/status (Brice Goglin/Lee Shermerhorn)
+- Small reorganization of numa_alloc_local() (L.S.)
+- Fixes of bitmask memory leaks in about eight functions (L.S.)
+- Make library always return allocated masks that user can free (L.S.)
+- Fix to numademo memtest (allocation overhead) (L.S.)
+- Fix to checkaffinity test (possible shell errors) (L.S.)
+- Fix a printf in migspeed.c (Frederik Himpe)
+- Fix test/regress grep of node nummber (Cliff W.)
+- Change numademo to finish in a timely manner on large machines (Cliff W.)
+- tested on 96p 48nodes
+2.0.3-rc1 - rc4
+- Add --dump-nodes option to numactl (Andi)
+
+2.0.4-rc1
+- Fix numactl for a machine with sparse cpu ids (Anton Blanchard)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/distance.c new/numactl-2.0.4-rc1/distance.c
--- old/numactl-2.0.3-rc1/distance.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/distance.c 2009-08-31 14:37:13.000000000 +0200
@@ -26,25 +26,16 @@
static int distance_numnodes;
static int *distance_table;
-static int count_numbers(char *s)
-{
- int n = 0;
- for (;;) {
- char *end;
- strtoul(s, &end, 0);
- if (s == end)
- return n;
- s = end;
- n++;
- }
-}
-
static void parse_numbers(char *s, int *iptr, int n)
{
- int i;
+ int i, d, j;
char *end;
- for (i = 0; i < n; i++) {
- *iptr++ = strtoul(s, &end, 0);
+ for (i = 0, j = 0; i < n; i++, j++) {
+ d = strtoul(s, &end, 0);
+ /* Skip unavailable nodes */
+ while (j 0)
err = 0;
- break;
+ if (!err && ndsize) {
- if (is_bigendian_64) {
- ip = (unsigned int *)bmp->maskp;
- return (ip[n/bitsperint] >>
- (n % bitsperint)) & 1;
- } else
- return (bmp->maskp[n/bitsperlong] >>
- (n % bitsperlong)) & 1;
- } else
- return 0;
+ if (n < bmp->size)
+ return (bmp->maskp[n/bitsperlong] >> (n % bitsperlong)) & 1;
+ else
+ return 0;
}
static void
@@ -402,11 +370,13 @@
read_mask(char *s, struct bitmask *bmp)
{
char *end = s;
- unsigned int *start = (unsigned int *)bmp->maskp;
- unsigned int *p = start;
- unsigned int *q;
- unsigned int i;
- unsigned int n = 0;
+ int tmplen = (bmp->size + bitsperint - 1) / bitsperint;
+ unsigned int tmp[tmplen];
+ unsigned int *start = tmp;
+ unsigned int i, n = 0, m = 0;
+
+ if (!s)
+ return 0; /* shouldn't happen */
i = strtoul(s, &end, 16);
@@ -414,7 +384,6 @@
while (!i && *end++ == ',') {
i = strtoul(end, &end, 16);
}
- end++; /* past the , */
if (!i)
/* End of string. No mask */
@@ -422,33 +391,39 @@
start[n++] = i;
/* Read sequence of ints */
- do {
+ while (*end++ == ',') {
i = strtoul(end, &end, 16);
- if (i)
- start[n++] = i;
- } while (*end++ == ',');
- n--;
+ start[n++] = i;
+
+ /* buffer overflow */
+ if (n > tmplen)
+ return -1;
+ }
/*
* Invert sequence of ints if necessary since the first int
* is the highest and we put it first because we read it first.
*/
- for (q = start + n, p = start; p < q; q--, p++) {
- unsigned int x = *q;
+ while (n) {
+ int w;
+ unsigned long x = 0;
+ /* read into long values in an endian-safe way */
+ for (w = 0; n && w < bitsperlong; w += bitsperint)
+ x |= ((unsigned long)start[n-- - 1] << w);
- *q = *p;
- *p = x;
+ bmp->maskp[m++] = x;
}
+ m--;
/* Poor mans fls() */
- for(i = 31; i >= 0; i--)
- if (test_bit(i, start + n))
+ for(i = bitsperlong - 1; i >= 0; i--)
+ if (test_bit(i, bmp->maskp + m))
break;
/*
* Return the last bit set
*/
- return ((sizeof(unsigned int)*8) * n) + i;
+ return bitsperlong * m + i;
}
/*
@@ -475,12 +450,21 @@
}
while (getline(&buffer, &buflen, f) > 0) {
+ /* mask starts after [last] tab */
+ char *mask = strrchr(buffer,'\t') + 1;
+
if (strncmp(buffer,"Cpus_allowed:",13) == 0)
- maxproccpu = read_mask(buffer + 15, numa_all_cpus_ptr);
+ maxproccpu = read_mask(mask, numa_all_cpus_ptr);
if (strncmp(buffer,"Mems_allowed:",13) == 0) {
maxprocnode =
- read_mask(buffer + 15, numa_all_nodes_ptr);
+ read_mask(mask, 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);
@@ -785,6 +769,7 @@
nodes = numa_allocate_nodemask();
numa_bitmask_setbit(nodes, node);
dombind(mem, size, bind_policy, nodes);
+ numa_bitmask_free(nodes);
}
void
@@ -912,6 +897,7 @@
copy_bitmask_to_nodemask(bmp, &mask);
else
copy_bitmask_to_nodemask(numa_no_nodes_ptr, &mask);
+ numa_bitmask_free(bmp);
return mask;
}
__asm__(".symver numa_get_interleave_mask_v1,numa_get_interleave_mask@libnuma_1.1");
@@ -924,9 +910,9 @@
bmp = numa_allocate_nodemask();
getpol(&oldpolicy, bmp);
- if (oldpolicy == MPOL_INTERLEAVE)
- return bmp;
- return numa_no_nodes_ptr;
+ if (oldpolicy != MPOL_INTERLEAVE)
+ copy_bitmask_to_bitmask(numa_no_nodes_ptr, bmp);
+ return bmp;
}
__asm__(".symver numa_get_interleave_mask_v2,numa_get_interleave_mask@@libnuma_1.2");
@@ -949,8 +935,10 @@
mem = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
0, 0);
if (mem == (char *)-1)
- return NULL;
- dombind(mem, size, bind_policy, bmp);
+ mem = NULL;
+ else
+ dombind(mem, size, bind_policy, bmp);
+ numa_bitmask_free(bmp);
return mem;
}
@@ -960,8 +948,9 @@
mem = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
0, 0);
if (mem == (char *)-1)
- return NULL;
- dombind(mem, size, MPOL_PREFERRED, NULL);
+ mem = NULL;
+ else
+ dombind(mem, size, MPOL_PREFERRED, NULL);
return mem;
}
@@ -1056,17 +1045,19 @@
{
int oldpolicy;
struct bitmask *bmp;
- nodemask_t *nmp;
+ nodemask_t nmp;
bmp = allocate_nodemask_v1();
getpol(&oldpolicy, bmp);
if (oldpolicy == MPOL_BIND) {
- nmp = (nodemask_t *)bmp->maskp;
- return *nmp;
+ copy_bitmask_to_nodemask(bmp, &nmp);
+ } else {
+ /* copy the body of the map to numa_all_nodes */
+ copy_bitmask_to_nodemask(bmp, &numa_all_nodes);
+ nmp = numa_all_nodes;
}
- /* copy the body of the map to numa_all_nodes */
- copy_bitmask_to_nodemask(bmp, &numa_all_nodes);
- return numa_all_nodes;
+ numa_bitmask_free(bmp);
+ return nmp;
}
__asm__(".symver numa_get_membind_v1,numa_get_membind@libnuma_1.1");
@@ -1078,9 +1069,9 @@
bmp = numa_allocate_nodemask();
getpol(&oldpolicy, bmp);
- if (oldpolicy == MPOL_BIND)
- return bmp;
- return numa_all_nodes_ptr;
+ if (oldpolicy != MPOL_BIND)
+ copy_bitmask_to_bitmask(numa_all_nodes_ptr, bmp);
+ return bmp;
}
__asm__(".symver numa_get_membind_v2,numa_get_membind@@libnuma_1.2");
@@ -1330,6 +1321,33 @@
make_internal_alias(numa_node_to_cpus_v1);
make_internal_alias(numa_node_to_cpus_v2);
+/* report the node of the specified cpu */
+int numa_node_of_cpu(int cpu)
+{
+ struct bitmask *bmp;
+ int ncpus, nnodes, node, ret;
+
+ ncpus = numa_num_possible_cpus();
+ if (cpu > ncpus){
+ errno = EINVAL;
+ return -1;
+ }
+ bmp = numa_bitmask_alloc(ncpus);
+ nnodes = numa_num_configured_nodes();
+ for (node = 0; node < nnodes; node++){
+ numa_node_to_cpus_v2_int(node, bmp);
+ if (numa_bitmask_isbitset(bmp, cpu)){
+ ret = node;
+ goto end;
+ }
+ }
+ ret = -1;
+ errno = EINVAL;
+end:
+ numa_bitmask_free(bmp);
+ return ret;
+}
+
int
numa_run_on_node_mask_v1(const nodemask_t *mask)
@@ -1415,13 +1433,13 @@
}
err = numa_sched_setaffinity_v2_int(0, cpus);
+ numa_bitmask_free(cpus);
+ numa_bitmask_free(nodecpus);
+
/* used to have to consider that this could fail - it shouldn't now */
if (err < 0) {
numa_error("numa_sched_setaffinity_v2_int() failed; abort\n");
- return -1;
}
- numa_bitmask_free(cpus);
- numa_bitmask_free(nodecpus);
return err;
}
@@ -1436,14 +1454,16 @@
int i, k;
int max = numa_max_node_int();
struct bitmask *bmp, *cpus, *nodecpus;
- nodemask_t *nmp;
+ nodemask_t nmp;
- bmp = allocate_nodemask_v1(); /* the size of a nodemask_t */
cpus = numa_allocate_cpumask();
- nodecpus = numa_allocate_cpumask();
- if (numa_sched_getaffinity_v2_int(0, cpus) < 0)
- return numa_no_nodes;
+ if (numa_sched_getaffinity_v2_int(0, cpus) < 0){
+ nmp = numa_no_nodes;
+ goto free_cpus;
+ }
+ nodecpus = numa_allocate_cpumask();
+ bmp = allocate_nodemask_v1(); /* the size of a nodemask_t */
for (i = 0; i <= max; i++) {
if (numa_node_to_cpus_v2_int(i, nodecpus) < 0) {
/* It's possible for the node to not exist */
@@ -1454,8 +1474,12 @@
numa_bitmask_setbit(bmp, i);
}
}
- nmp = (nodemask_t *)bmp->maskp;
- return *nmp;
+ copy_bitmask_to_nodemask(bmp, &nmp);
+ numa_bitmask_free(bmp);
+ numa_bitmask_free(nodecpus);
+free_cpus:
+ numa_bitmask_free(cpus);
+ return nmp;
}
__asm__(".symver numa_get_run_node_mask_v1,numa_get_run_node_mask@libnuma_1.1");
@@ -1467,13 +1491,15 @@
int max = numa_max_node_int();
struct bitmask *bmp, *cpus, *nodecpus;
+
bmp = numa_allocate_cpumask();
cpus = numa_allocate_cpumask();
- nodecpus = numa_allocate_cpumask();
-
- if (numa_sched_getaffinity_v2_int(0, cpus) < 0)
- return numa_no_nodes_ptr;
+ if (numa_sched_getaffinity_v2_int(0, cpus) < 0){
+ copy_bitmask_to_bitmask(numa_no_nodes_ptr, bmp);
+ goto free_cpus;
+ }
+ nodecpus = numa_allocate_cpumask();
for (i = 0; i <= max; i++) {
if (numa_node_to_cpus_v2_int(i, nodecpus) < 0) {
/* It's possible for the node to not exist */
@@ -1484,6 +1510,9 @@
numa_bitmask_setbit(bmp, i);
}
}
+ numa_bitmask_free(nodecpus);
+free_cpus:
+ numa_bitmask_free(cpus);
return bmp;
}
__asm__(".symver numa_get_run_node_mask_v2,numa_get_run_node_mask@@libnuma_1.2");
@@ -1506,27 +1535,34 @@
int numa_run_on_node(int node)
{
int numa_num_nodes = numa_num_possible_nodes();
+ int ret = -1;
struct bitmask *cpus;
+ if (node >= numa_num_nodes){
+ errno = EINVAL;
+ goto out;
+ }
+
cpus = numa_allocate_cpumask();
- if (node == -1) {
+
+ if (node == -1)
numa_bitmask_setall(cpus);
- } else if (node < numa_num_nodes) {
- if (numa_node_to_cpus_v2_int(node, cpus) < 0) {
- numa_warn(W_noderunmask,
- "Cannot read node cpumask from sysfs");
- return -1;
- }
- } else {
- errno = EINVAL;
- return -1;
+ else if (numa_node_to_cpus_v2_int(node, cpus) < 0){
+ numa_warn(W_noderunmask, "Cannot read node cpumask from sysfs");
+ goto free;
}
- return numa_sched_setaffinity_v2_int(0, cpus);
+
+ ret = numa_sched_setaffinity_v2_int(0, cpus);
+free:
+ numa_bitmask_free(cpus);
+out:
+ return ret;
}
int numa_preferred(void)
{
int policy;
+ int ret;
struct bitmask *bmp;
bmp = numa_allocate_nodemask();
@@ -1535,12 +1571,17 @@
int i;
int max = numa_num_possible_nodes();
for (i = 0; i < max ; i++)
- if (numa_bitmask_isbitset(bmp, i))
- return i;
+ if (numa_bitmask_isbitset(bmp, i)){
+ ret = i;
+ goto end;
+ }
}
/* could read the current CPU from /proc/self/status. Probably
not worth it. */
- return 0; /* or random one? */
+ ret = 0; /* or random one? */
+end:
+ numa_bitmask_free(bmp);
+ return ret;
}
void numa_set_preferred(int node)
@@ -1632,8 +1673,10 @@
mask = numa_allocate_nodemask();
- if (s[0] == 0)
- return numa_no_nodes_ptr;
+ if (s[0] == 0){
+ copy_bitmask_to_bitmask(numa_no_nodes_ptr, mask);
+ return mask; /* return freeable mask */
+ }
if (*s == '!') {
invert = 1;
s++;
@@ -1686,7 +1729,7 @@
}
} while (*s++ == ',');
if (s[-1] != '\0')
- return 0;
+ goto err;
if (invert) {
int i;
for (i = 0; i < conf_nodes; i++) {
@@ -1782,7 +1825,7 @@
}
} while (*s++ == ',');
if (s[-1] != '\0')
- return 0;
+ goto err;
if (invert) {
int i;
for (i = 0; i < conf_cpus; i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/Makefile new/numactl-2.0.4-rc1/Makefile
--- old/numactl-2.0.3-rc1/Makefile 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/Makefile 2009-08-31 14:37:13.000000000 +0200
@@ -48,8 +48,8 @@
migratepages: migratepages.c util.o bitops.o libnuma.so
+migspeed: LDLIBS += -lrt
migspeed: migspeed.o util.o libnuma.so
- ${CC} migspeed.c -o migspeed util.o libnuma.so -lrt
util.o: util.c
@@ -57,7 +57,7 @@
numactl.o: numactl.c
-numademo: override LDFLAGS += -lm
+numademo: LDLIBS += -lm
# GNU make 3.80 appends BENCH_CFLAGS twice. Bug? It's harmless though.
numademo: CFLAGS += -DHAVE_STREAM_LIB -DHAVE_MT -DHAVE_CLEAR_CACHE ${BENCH_CFLAGS}
stream_lib.o: CFLAGS += ${BENCH_CFLAGS}
@@ -72,24 +72,27 @@
numamon: numamon.o
+stream: LDLIBS += -lm
stream: stream_lib.o stream_main.o libnuma.so util.o
- ${CC} -o stream ${CFLAGS} stream_lib.o stream_main.o util.o -L. -lnuma -lm
+ ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDLIBS}
stream_main.o: stream_main.c
libnuma.so.1: versions.ldscript
libnuma.so.1: libnuma.o syscall.o distance.o
- ${CC} -shared -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o libnuma.so.1 $(filter-out versions.ldscript,$^)
+ ${CC} ${LDFLAGS} -shared -Wl,-soname=libnuma.so.1 -Wl,--version-script,versions.ldscript -Wl,-init,numa_init -o libnuma.so.1 $(filter-out versions.ldscript,$^)
libnuma.so: libnuma.so.1
ln -sf libnuma.so.1 libnuma.so
libnuma.o : CFLAGS += -fPIC
+AR ?= ar
+RANLIB ?= ranlib
libnuma.a: libnuma.o syscall.o distance.o
- ar rc $@ $^
- ranlib $@
+ $(AR) rc $@ $^
+ $(RANLIB) $@
distance.o : CFLAGS += -fPIC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/migspeed.c new/numactl-2.0.4-rc1/migspeed.c
--- old/numactl-2.0.3-rc1/migspeed.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/migspeed.c 2009-08-31 14:37:13.000000000 +0200
@@ -55,7 +55,7 @@
break;
if (!strstr(buffer, "bind"))
continue ;
- printf(buffer);
+ printf("%s", buffer);
}
fclose(f);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/mkolddemo new/numactl-2.0.4-rc1/mkolddemo
--- old/numactl-2.0.3-rc1/mkolddemo 1970-01-01 01:00:00.000000000 +0100
+++ new/numactl-2.0.4-rc1/mkolddemo 2009-08-31 14:37:13.000000000 +0200
@@ -0,0 +1,9 @@
+# test the numacompat1.h stuff by compiling an old version of numademo.c
+
+cc -L. -lnuma -I. -DNUMA_VERSION1_COMPATIBILITY -o olddemo olddemo.c
+
+
+export LD_LIBRARY_PATH=.
+echo "executing olddemo:"
+./olddemo
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/numa.3 new/numactl-2.0.4-rc1/numa.3
--- old/numactl-2.0.3-rc1/numa.3 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/numa.3 2009-08-31 14:37:13.000000000 +0200
@@ -115,6 +115,8 @@
.BI "int numa_sched_setaffinity(pid_t " pid ", struct bitmask *" mask );
.br
.BI "int numa_node_to_cpus(int " node ", unsigned long *" buffer ", int " bufferlen );
+.br
+.BI "int numa_node_of_cpu(int " cpu ");
.sp
.BI "struct bitmask *numa_allocate_cpumask();"
.sp
@@ -220,6 +222,7 @@
their memory.
The exceptions to this are:
.IR numa_node_to_cpus (),
+.IR numa_node_of_cpu (),
.IR numa_bind (),
.IR numa_run_on_node (),
.IR numa_run_on_node_mask ()
@@ -730,6 +733,13 @@
.I ERANGE
and \-1 returned. On success 0 is returned.
+.BR numa_node_of_cpu ()
+returns the node that a cpu belongs to. If the user supplies an invalid cpu
+.I errno
+will be set to
+.I EINVAL
+and \-1 will be returned.
+
.BR numa_allocate_cpumask
() returns a bitmask of a size equal to the kernel's cpu
mask (kernel type cpumask_t). In other words, large enough to represent
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/numactl.8 new/numactl-2.0.4-rc1/numactl.8
--- old/numactl-2.0.3-rc1/numactl.8 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/numactl.8 2009-08-31 14:37:13.000000000 +0200
@@ -64,6 +64,8 @@
.B \-\-touch
] [
.B \-\-dump
+] [
+.B \-\-dump-nodes
]
memory policy
.SH DESCRIPTION
@@ -225,6 +227,9 @@
.B \-\-dump
Dump policy in the specified range.
.TP
+.B \-\-dump-nodes
+Dump all nodes of the specific range (very verbose!)
+.TP
Valid node specifiers
.TS
tab(:);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/numactl.c new/numactl-2.0.4-rc1/numactl.c
--- old/numactl-2.0.3-rc1/numactl.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/numactl.c 2009-08-31 14:37:13.000000000 +0200
@@ -49,6 +49,7 @@
{"strict", 0, 0, 't'},
{"shmmode", 1, 0, 'M'},
{"dump", 0, 0, 'd'},
+ {"dump-nodes", 0, 0, 'D'},
{"shmid", 1, 0, 'I'},
{"huge", 0, 0, 'u'},
{"touch", 0, 0, 'T'},
@@ -67,8 +68,8 @@
" numactl [--length length] [--offset offset] [--shmmode shmmode]\n"
" [--strict]\n"
" [--shmid id] --shm shmkeyfile | --file tmpfsfile\n"
- " [--huge] [--touch]\n"
- " memory policy\n"
+ " [--huge] [--touch] \n"
+ " memory policy | --dump | --dump-nodes\n"
"\n"
"memory policy is --interleave, --preferred, --membind, --localalloc\n"
"nodes is a comma delimited list of node numbers or A-B ranges or all.\n"
@@ -199,40 +200,39 @@
void print_node_cpus(int node)
{
- int len = 1;
- int conf_cpus = numa_num_configured_cpus();
+ int i, err;
+ struct bitmask *cpus;
- for (;;) {
- int i, err;
- struct bitmask *cpus;
-
- cpus = numa_bitmask_alloc(conf_cpus);
- errno = 0;
- err = numa_node_to_cpus(node, cpus);
- if (err < 0) {
- if (errno == ERANGE) {
- len *= 2;
- continue;
- }
- break;
- }
- for (i = 0; i < len*BITS_PER_LONG; i++)
+ cpus = numa_allocate_cpumask();
+ err = numa_node_to_cpus(node, cpus);
+ if (err >= 0)
+ for (i = 0; i < cpus->size; i++)
if (numa_bitmask_isbitset(cpus, i))
printf(" %d", i);
- break;
- }
putchar('\n');
}
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));
@@ -463,10 +463,18 @@
break;
case 'd': /* --dump */
if (shmfd < 0)
- complain("Cannot do --dump without shared memory.\n");
+ complain(
+ "Cannot do --dump without shared memory.\n");
dump_shm();
do_dump = 1;
break;
+ case 'D': /* --dump-nodes */
+ if (shmfd < 0)
+ complain(
+ "Cannot do --dump-nodes without shared memory.\n");
+ dump_shm_nodes();
+ do_dump = 1;
+ break;
case 't': /* --strict */
did_strict = 1;
numa_set_strict(1);
@@ -518,10 +526,11 @@
}
if (did_strict)
- fprintf(stderr,"numactl: warning. Strict flag for process ignored.\n");
+ fprintf(stderr,
+ "numactl: warning. Strict flag for process ignored.\n");
if (do_dump)
- usage_msg("cannot do --dump for process");
+ usage_msg("cannot do --dump|--dump-shm for process");
if (shmoption)
usage_msg("shm related option %s for process", shmoption);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/numademo.c new/numactl-2.0.4-rc1/numademo.c
--- old/numactl-2.0.3-rc1/numademo.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/numademo.c 2009-08-31 14:37:13.000000000 +0200
@@ -37,6 +37,7 @@
#endif
#define FRACT_NODES 8
#define FRACT_MASKS 32
+int fract_nodes;
unsigned long msize;
@@ -165,7 +166,11 @@
max = 0;
min = ~0UL;
sum = 0;
- for (i = 0; i < LOOPS; i++) {
+
+ /*
+ * Note: 0th pass allocates the pages, don't measure
+ */
+ for (i = 0; i < LOOPS+1; i++) {
clearcache(mem, msize);
switch (thistest) {
case PTRCHASE:
@@ -240,6 +245,9 @@
break;
}
+ if (!i)
+ continue; /* don't count allocation pass */
+
timersub(&end, &start, &res);
r = timerfold(&res);
if (r > max) max = r;
@@ -296,7 +304,7 @@
if (regression_testing) {
printf("\nTest %s doing 1 of %d nodes and 1 of %d masks.\n",
- testname[thistest], FRACT_NODES, FRACT_MASKS);
+ testname[thistest], fract_nodes, FRACT_MASKS);
}
memtest("memory with no policy", numa_alloc(msize));
@@ -304,7 +312,7 @@
memtest("memory interleaved on all nodes", numa_alloc_interleaved(msize));
for (i = 0; i <= max_node; i++) {
- if (regression_testing && (i % FRACT_NODES)) {
+ if (regression_testing && (i % fract_nodes)) {
/* for regression testing (-t) do only every eighth node */
continue;
}
@@ -317,6 +325,9 @@
char buf2[10];
if (popcnt(mask) == 1)
continue;
+ if (regression_testing && (i > 50)) {
+ break;
+ }
if (regression_testing && (i % FRACT_MASKS)) {
/* for regression testing (-t)
do only every 32nd mask permutation */
@@ -338,7 +349,7 @@
}
for (i = 0; i <= max_node; i++) {
- if (regression_testing && (i % FRACT_NODES)) {
+ if (regression_testing && (i % fract_nodes)) {
/* for regression testing (-t) do only every eighth node */
continue;
}
@@ -366,7 +377,7 @@
for (i = 0; i <= max_node; i++) {
int oldhn = numa_preferred();
- if (regression_testing && (i % FRACT_NODES)) {
+ if (regression_testing && (i % fract_nodes)) {
/* for regression testing (-t) do only every eighth node */
continue;
}
@@ -389,7 +400,7 @@
for (k = 0; k <= max_node; k++) {
if (k == i)
continue;
- if (regression_testing && (k % FRACT_NODES)) {
+ if (regression_testing && (k % fract_nodes)) {
/* for regression testing (-t)
do only every eighth node */
continue;
@@ -484,6 +495,7 @@
max_node = numa_max_node();
printf("%d nodes available\n", max_node+1);
+ fract_nodes = ((max_node/8)*2) + FRACT_NODES;
if (max_node <= 2)
regression_testing = 0; /* set -t auto-off for small systems */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/numa.h new/numactl-2.0.4-rc1/numa.h
--- old/numactl-2.0.3-rc1/numa.h 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/numa.h 2009-08-31 14:37:13.000000000 +0200
@@ -161,6 +161,8 @@
/* 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);
@@ -271,6 +273,9 @@
/* Convert node to CPU mask. -1/errno on failure, otherwise 0. */
int numa_node_to_cpus(int, struct bitmask *);
+/* report the node of the specified cpu. -1/errno on invalid cpu. */
+int numa_node_of_cpu(int cpu);
+
/* Report distance of node1 from node2. 0 on error.*/
int numa_distance(int node1, int node2);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/shm.c new/numactl-2.0.4-rc1/shm.c
--- old/numactl-2.0.3-rc1/shm.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/shm.c 2009-08-31 14:37:14.000000000 +0200
@@ -202,6 +202,37 @@
dumppol(start, c, prevpol, prevnodes);
}
+static void dumpnode(unsigned long long start, unsigned long long end, int node)
+{
+ printf("%016Lx-%016Lx: %d\n", shmoffset+start, shmoffset+end, node);
+}
+
+/* Dump nodes in a shared memory segment. */
+void dump_shm_nodes(void)
+{
+ int prevnode = -1, node;
+ unsigned long long c, start;
+
+ start = 0;
+ if (shmlen == 0) {
+ printf("nothing to dump\n");
+ return;
+ }
+
+ for (c = 0; c < shmlen; c += shm_pagesize) {
+ if (get_mempolicy(&node, NULL, 0, c+shmptr,
+ MPOL_F_ADDR|MPOL_F_NODE) < 0)
+ err("get_mempolicy on shm");
+ if (node == prevnode)
+ continue;
+ if (prevnode != -1)
+ dumpnode(start, c, prevnode);
+ prevnode = node;
+ start = c;
+ }
+ dumpnode(start, c, prevnode);
+}
+
static void vwarn(char *ptr, char *fmt, ...)
{
va_list ap;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/shm.h new/numactl-2.0.4-rc1/shm.h
--- old/numactl-2.0.3-rc1/shm.h 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/shm.h 2009-08-31 14:37:14.000000000 +0200
@@ -8,6 +8,7 @@
extern int shmflags;
extern void dump_shm(void);
+extern void dump_shm_nodes(void);
extern void attach_shared(char *);
extern void attach_sysvshm(char *);
extern void verify_shm(int policy, struct bitmask *);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/test/checkaffinity new/numactl-2.0.4-rc1/test/checkaffinity
--- old/numactl-2.0.3-rc1/test/checkaffinity 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/test/checkaffinity 2009-08-31 14:37:14.000000000 +0200
@@ -9,11 +9,11 @@
numnodes=$(ls -1d /sys/devices/system/node/node[0-9]* | wc -l )
for i in $(seq 0 $[$numcpus - 1]) ; do
- if [ $(numactl --physcpubind=$i ./printcpu) != $i ] ; then
+ if [ "$(numactl --physcpubind=$i ./printcpu)" != "$i" ] ; then
echo "--physcpubind for $i doesn't work"
exit 1
fi
- if [ $(numactl --physcpubind=$i numactl --show | awk '/^physcpubind/ { print $2 }' ) != $i ] ; then
+ if [ "$(numactl --physcpubind=$i numactl --show | awk '/^physcpubind/ { print $2 }' )" != "$i" ] ; then
echo "--show doesn't agree with physcpubind for cpu $i"
exit 1
fi
Files old/numactl-2.0.3-rc1/test/move_pages and new/numactl-2.0.4-rc1/test/move_pages differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/test/prefered.c new/numactl-2.0.4-rc1/test/prefered.c
--- old/numactl-2.0.3-rc1/test/prefered.c 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/test/prefered.c 2009-08-31 14:37:14.000000000 +0200
@@ -6,20 +6,22 @@
#include
#include
#include
+#include
#define err(x) perror(x),exit(1)
int main(void)
{
int max = numa_max_node();
+ int maxmask = numa_num_possible_nodes();
struct bitmask *nodes, *mask;
int pagesize = getpagesize();
int i;
int pol;
int node;
int err = 0;
- nodes = numa_bitmask_alloc(max+1);
- mask = numa_bitmask_alloc(max+1);
+ nodes = numa_bitmask_alloc(maxmask);
+ mask = numa_bitmask_alloc(maxmask);
for (i = max; i >= 0; --i) {
char *mem = mmap(NULL, pagesize*(max+1), PROT_READ|PROT_WRITE,
@@ -33,7 +35,7 @@
numa_bitmask_clearall(nodes);
numa_bitmask_clearall(mask);
- numa_bitmask_setbit(mask, i);
+ numa_bitmask_setbit(nodes, i);
if (mbind(adr, pagesize, MPOL_PREFERRED, nodes->maskp,
nodes->size, 0) < 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/test/regress new/numactl-2.0.4-rc1/test/regress
--- old/numactl-2.0.3-rc1/test/regress 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/test/regress 2009-08-31 14:37:14.000000000 +0200
@@ -58,7 +58,7 @@
# find nodes with at least NEEDPAGES of free memory
for i in $(seq 0 $maxnode) ; do
- free=$(numactl --hardware | fgrep "$i free" | awk '{print $4}')
+ free=$(numactl --hardware | fgrep " $i free" | awk '{print $4}')
free=$(( free * MB ))
if [[ $((free / PAGESIZE)) -ge $NEEDPAGES ]]; then
node[$n]=$i
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/TODO new/numactl-2.0.4-rc1/TODO
--- old/numactl-2.0.3-rc1/TODO 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/TODO 2009-08-31 14:37:13.000000000 +0200
@@ -1,3 +1,5 @@
+last update Aug 16 2007:
+
need to fix hugetlbfs to allow holey files (for numactl)
numademo numbers seem to be unstable. investigate.
need more test programs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/versions.ldscript new/numactl-2.0.4-rc1/versions.ldscript
--- old/numactl-2.0.3-rc1/versions.ldscript 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/versions.ldscript 2009-08-31 14:37:14.000000000 +0200
@@ -118,6 +118,7 @@
numa_node_size64;
numa_node_size;
numa_node_to_cpus;
+ numa_node_of_cpu;
numa_num_configured_cpus;
numa_num_configured_nodes;
numa_num_possible_nodes;
@@ -143,6 +144,7 @@
numa_tonode_memory;
numa_tonodemask_memory;
numa_warn;
+ nodes_allowed_list;
local:
*;
} libnuma_1.1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.3-rc1/x new/numactl-2.0.4-rc1/x
--- old/numactl-2.0.3-rc1/x 2009-01-15 17:15:45.000000000 +0100
+++ new/numactl-2.0.4-rc1/x 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-quilt import /home/estes02/cpw/0806_ak_patch16
-quilt import /home/estes02/cpw/0806_ak_patch15
-quilt import /home/estes02/cpw/0806_ak_patch14
-quilt import /home/estes02/cpw/0806_ak_patch13
-quilt import /home/estes02/cpw/0806_ak_patch12
-quilt import /home/estes02/cpw/0806_ak_patch11
-quilt import /home/estes02/cpw/0806_ak_patch10
-quilt import /home/estes02/cpw/0806_ak_patch9
-quilt import /home/estes02/cpw/0806_ak_patch8
-quilt import /home/estes02/cpw/0806_ak_patch7
-quilt import /home/estes02/cpw/0806_ak_patch6
-quilt import /home/estes02/cpw/0806_ak_patch5
-quilt import /home/estes02/cpw/0806_ak_patch4
-quilt import /home/estes02/cpw/0806_ak_patch2
-quilt import /home/estes02/cpw/0806_ak_patch1
++++++ numactl_install_all_manpages ++++++
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
Index: numactl-2.0.4-rc1/Makefile
===================================================================
--- numactl-2.0.4-rc1.orig/Makefile
+++ numactl-2.0.4-rc1/Makefile
@@ -135,6 +135,9 @@ install: numactl migratepages migspeed n
install -m 0755 memhog ${prefix}/bin
mkdir -p ${prefix}/share/man/man2 ${prefix}/share/man/man8 ${prefix}/share/man/man3
install -m 0644 numactl.8 ${prefix}/share/man/man8
+ install -m 0644 numastat.8 ${prefix}/share/man/man8
+ install -m 0644 migratepages.8 ${prefix}/share/man/man8
+ install -m 0644 migspeed.8 ${prefix}/share/man/man8
install -m 0644 numa.3 ${prefix}/share/man/man3
( cd ${prefix}/share/man/man3 ; for i in $$(./manlinks) ; do ln -sf numa.3 $$i.3 ; done )
mkdir -p ${libdir}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org