Resolves: bz506795

This commit is contained in:
Neil Horman 2009-06-29 15:56:53 +00:00
parent 5f04d3b8a7
commit 02ea991435
10 changed files with 72 additions and 143 deletions

View File

@ -1 +1,2 @@
numactl-2.0.2.tar.gz
numactl-2.0.3.tar.gz

View File

@ -1,17 +0,0 @@
diff -up numactl-1.0.2/syscall.c.orig numactl-1.0.2/syscall.c
--- numactl-1.0.2/syscall.c.orig 2008-03-14 07:28:58.000000000 -0400
+++ numactl-1.0.2/syscall.c 2008-03-14 07:29:31.000000000 -0400
@@ -62,6 +62,13 @@
#define __NR_set_mempolicy 261
#define __NR_migrate_pages 258
+#elif defined(__alpha__)
+
+#define __NR_mbind 429
+#define __NR_get_mempolicy 430
+#define __NR_set_mempolicy 431
+#define __NR_migrate_pages 449
+
#elif !defined(DEPS_RUN)
#error "Add syscalls for your architecture or update kernel headers"
#endif

View File

@ -1,63 +0,0 @@
diff -up numactl-1.0.2/numactl.c.orig numactl-1.0.2/numactl.c
--- numactl-1.0.2/numactl.c.orig 2007-09-21 06:23:51.000000000 -0400
+++ numactl-1.0.2/numactl.c 2008-04-25 09:10:05.000000000 -0400
@@ -355,14 +355,14 @@ int main(int ac, char **av)
break;
case 'C': /* --physcpubind */
{
- int ncpus;
+ int bufsz;
unsigned long *cpubuf;
dontshm("-C/--physcpubind");
- cpubuf = cpumask(optarg, &ncpus);
+ cpubuf = cpumask(optarg, &bufsz);
errno = 0;
check_cpubind(do_shm);
did_cpubind = 1;
- numa_sched_setaffinity(0, CPU_BYTES(ncpus), cpubuf);
+ numa_sched_setaffinity(0, bufsz, cpubuf);
checkerror("sched_setaffinity");
free(cpubuf);
break;
diff -up numactl-1.0.2/util.h.orig numactl-1.0.2/util.h
--- numactl-1.0.2/util.h.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.h 2008-04-25 09:10:05.000000000 -0400
@@ -1,7 +1,7 @@
extern void printmask(char *name, nodemask_t *mask);
extern void printcpumask(char *name, unsigned long *mask, int len);
extern nodemask_t nodemask(char *s);
-extern unsigned long *cpumask(char *s, int *ncpus);
+extern unsigned long *cpumask(char *s, int *bufsz);
extern int read_sysctl(char *name);
extern void complain(char *fmt, ...);
extern void nerror(char *fmt, ...);
diff -up numactl-1.0.2/util.c.orig numactl-1.0.2/util.c
--- numactl-1.0.2/util.c.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/util.c 2008-04-25 09:10:45.000000000 -0400
@@ -52,7 +52,7 @@ void printmask(char *name, nodemask_t *m
int numcpus;
/* caller must free buffer */
-unsigned long *cpumask(char *s, int *ncpus)
+unsigned long *cpumask(char *s, int *bufsz)
{
int invert = 0;
char *end;
@@ -92,7 +92,7 @@ unsigned long *cpumask(char *s, int *ncp
unsigned long arg2 = strtoul(++s, &end2, 0);
if (end2 == s)
complain("missing cpu argument %s\n", s);
- if (arg > numcpus)
+ if (arg >= numcpus)
complain("cpu argument %d out of range\n", arg);
while (++arg <= arg2)
set_bit(arg, cpubuf);
@@ -110,7 +110,7 @@ unsigned long *cpumask(char *s, int *ncp
set_bit(i, cpubuf);
}
}
- *ncpus = cpubufsize;
+ *bufsz = cpubufsize;
return cpubuf;
}

View File

@ -1,36 +0,0 @@
diff -up numactl-1.0.2/syscall.c.orig numactl-1.0.2/syscall.c
--- numactl-1.0.2/syscall.c.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/syscall.c 2007-12-20 10:33:27.000000000 -0500
@@ -127,7 +127,7 @@ long syscall6(long call, long a, long b,
#endif
long WEAK get_mempolicy(int *policy,
- const unsigned long *nmask, unsigned long maxnode,
+ unsigned long *nmask, unsigned long maxnode,
void *addr, int flags)
{
return syscall(__NR_get_mempolicy, policy, nmask, maxnode, addr, flags);
diff -up numactl-1.0.2/numaint.h.orig numactl-1.0.2/numaint.h
--- numactl-1.0.2/numaint.h.orig 2007-12-20 10:33:53.000000000 -0500
+++ numactl-1.0.2/numaint.h 2007-12-20 10:33:58.000000000 -0500
@@ -5,7 +5,7 @@ extern int numa_sched_setaffinity(pid_t
extern int numa_sched_getaffinity(pid_t pid, unsigned len, const unsigned long *mask);
extern int numa_sched_setaffinity_int(pid_t pid, unsigned len,const unsigned long *mask);
extern int numa_sched_getaffinity_int(pid_t pid, unsigned len,const unsigned long *mask);
-extern long get_mempolicy_int(int *policy, const unsigned long *nmask,
+extern long get_mempolicy_int(int *policy, unsigned long *nmask,
unsigned long maxnode, void *addr, int flags);
extern long mbind_int(void *start, unsigned long len, int mode,
const unsigned long *nmask, unsigned long maxnode, unsigned flags);
diff -up numactl-1.0.2/numaif.h.orig numactl-1.0.2/numaif.h
--- numactl-1.0.2/numaif.h.orig 2007-08-16 10:36:23.000000000 -0400
+++ numactl-1.0.2/numaif.h 2007-12-20 10:33:27.000000000 -0500
@@ -9,7 +9,7 @@ extern "C" {
/* System calls */
extern long get_mempolicy(int *policy,
- const unsigned long *nmask, unsigned long maxnode,
+ unsigned long *nmask, unsigned long maxnode,
void *addr, int flags);
extern long mbind(void *start, unsigned long len, int mode,
const unsigned long *nmask, unsigned long maxnode, unsigned flags);

View File

@ -1,12 +0,0 @@
diff -up numactl-2.0.2/clearcache.c.orig numactl-2.0.2/clearcache.c
--- numactl-2.0.2/clearcache.c.orig 2008-09-29 16:08:38.000000000 -0400
+++ numactl-2.0.2/clearcache.c 2008-09-29 16:08:49.000000000 -0400
@@ -57,7 +57,7 @@ void clearcache(unsigned char *mem, unsi
#if defined(__i386__) || defined(__x86_64__)
unsigned i, cl, eax, feat;
/* get clflush unit and feature */
- asm("cpuid" : "=a" (eax), "=b" (cl), "=d" (feat) : "0" (1) : "cx");
+ asm("cpuid" : "=a" (eax), "=r" (cl), "=d" (feat) : "0" (1) : "cx");
if (!(feat & (1 << 19)))
fallback_clearcache();
cl = ((cl >> 8) & 0xff) * 8;

View File

@ -1,13 +0,0 @@
diff -up numactl-2.0.2/libnuma.c.orig numactl-2.0.2/libnuma.c
--- numactl-2.0.2/libnuma.c.orig 2009-02-09 15:26:41.000000000 -0500
+++ numactl-2.0.2/libnuma.c 2009-02-09 15:26:45.000000000 -0500
@@ -306,9 +306,6 @@ set_configured_nodes(void)
d = opendir("/sys/devices/system/node");
if (!d) {
- numa_warn(W_nosysfs,
- "/sys not mounted or no numa system. Assuming one node: %s",
- strerror(errno));
maxconfigurednode = 0;
} else {
while ((de = readdir(d)) != NULL) {

View File

@ -0,0 +1,38 @@
diff -up numactl-2.0.3-rc3/distance.c.orig numactl-2.0.3-rc3/distance.c
--- numactl-2.0.3-rc3/distance.c.orig 2009-05-08 10:10:06.000000000 -0400
+++ numactl-2.0.3-rc3/distance.c 2009-05-08 10:13:01.000000000 -0400
@@ -50,6 +50,7 @@ static int read_distance_table(void)
int numnodes = 0;
int *table = NULL;
int err = -1;
+ int found_nodes = 0;
for (nd = 0;; nd++) {
char fn[100];
@@ -57,7 +58,7 @@ static int read_distance_table(void)
sprintf(fn, "/sys/devices/system/node/node%d/distance", nd);
dfh = fopen(fn, "r");
if (!dfh) {
- if (errno == ENOENT && nd > 0)
+ if (errno == ENOENT)
err = 0;
if (!err && nd<numa_num_configured_nodes())
continue;
@@ -79,14 +80,15 @@ static int read_distance_table(void)
}
parse_numbers(line, table + nd * numnodes, numnodes);
+ found_nodes++;
}
free(line);
- if (err) {
+ if (!found_nodes) {
numa_warn(W_distance,
"Cannot parse distance information in sysfs: %s",
strerror(errno));
free(table);
- return err;
+ return -1;
}
/* Update the global table pointer. Race window here with
other threads, but in the worst case we leak one distance

View File

@ -0,0 +1,31 @@
diff -up numactl-2.0.3-rc3/libnuma.c.orig numactl-2.0.3-rc3/libnuma.c
--- numactl-2.0.3-rc3/libnuma.c.orig 2009-06-17 13:13:28.000000000 -0400
+++ numactl-2.0.3-rc3/libnuma.c 2009-06-17 13:14:10.000000000 -0400
@@ -1209,9 +1209,10 @@ numa_node_to_cpus_v1(int node, unsigned
sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
f = fopen(fn, "r");
if (!f || getdelim(&line, &len, '\n', f) < 1) {
- numa_warn(W_nosysfs2,
- "/sys not mounted or invalid. Assuming one node: %s",
- strerror(errno));
+ if (f)
+ numa_warn(W_nosysfs2,
+ "/sys not mounted or invalid. Assuming one node: %s",
+ strerror(errno));
bitmask.maskp = (unsigned long *)mask;
bitmask.size = buflen_needed * 8;
numa_bitmask_setall(&bitmask);
@@ -1287,9 +1288,10 @@ numa_node_to_cpus_v2(int node, struct bi
sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
f = fopen(fn, "r");
if (!f || getdelim(&line, &len, '\n', f) < 1) {
- numa_warn(W_nosysfs2,
- "/sys not mounted or invalid. Assuming one node: %s",
- strerror(errno));
+ if (f)
+ numa_warn(W_nosysfs2,
+ "/sys not mounted or invalid. Assuming one node: %s",
+ strerror(errno));
numa_bitmask_setall(mask);
err = -1;
}

View File

@ -1,7 +1,7 @@
Name: numactl
Summary: Library for tuning for Non Uniform Memory Access machines
Version: 2.0.3
Release: 1%{dist}
Release: 2%{dist}
License: LGPLv2/GPLv2
Group: System Environment/Base
URL: ftp://oss.sgi.com/www/projects/libnuma/download

View File

@ -1 +1 @@
82fe5bba94368850c8f5ffd0752b500b numactl-2.0.2.tar.gz
8e4fb249e5f719c25d7f433964fb9220 numactl-2.0.3.tar.gz