numactl/numactl-compat.diff

164 lines
5.6 KiB
Diff

diff -Nurp numactl-2.0.2/CHANGES numactl-2.0.3-rc1/CHANGES
--- numactl-2.0.2/CHANGES 2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.3-rc1/CHANGES 2008-11-20 00:54:06.000000000 +0100
@@ -269,3 +269,6 @@ updating in newer kernels (Mel Gorman)
- Fix numaif.h and numaint.h (migrate_pages; from Masatake Yamato)
- Fixes to numademo (min/max, and array index; from Kent Liu)
- Fixes to Makefile and permissions; from Berhard Walle
+
+2.0.3-rc1
+- Fixes to libnuma.c numa.h numacompat1.h by Daniel Rahn to fix v1 compatiblity
diff -Nurp numactl-2.0.2/libnuma.c numactl-2.0.3-rc1/libnuma.c
--- numactl-2.0.2/libnuma.c 2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.3-rc1/libnuma.c 2008-11-20 00:54:06.000000000 +0100
@@ -74,24 +74,6 @@ int numa_exit_on_error = 0;
int numa_exit_on_warn = 0;
static void set_sizes(void);
-static inline void
-nodemask_set_v1(nodemask_t *mask, int node)
-{
- mask->n[node / (8*sizeof(unsigned long))] |=
- (1UL<<(node%(8*sizeof(unsigned long))));
-}
-
-static inline int
-nodemask_isset_v1(const nodemask_t *mask, int node)
-{
- if ((unsigned)node >= NUMA_NUM_NODES)
- return 0;
- if (mask->n[node / (8*sizeof(unsigned long))] &
- (1UL<<(node%(8*sizeof(unsigned long)))))
- return 1;
- return 0;
-}
-
/*
* There are two special functions, _init(void) and _fini(void), which
* are called automatically by the dynamic loader whenever a library is loaded.
@@ -107,7 +89,7 @@ numa_init(void)
/* numa_all_nodes should represent existing nodes on this system */
max = numa_num_configured_nodes();
for (i = 0; i < max; i++)
- nodemask_set_v1((nodemask_t *)&numa_all_nodes, i);
+ nodemask_set_compat((nodemask_t *)&numa_all_nodes, i);
memset(&numa_no_nodes, 0, sizeof(numa_no_nodes));
}
@@ -509,7 +491,7 @@ set_thread_constraints(void)
static void
set_numa_max_cpu(void)
{
- int len = 2048;
+ int len = 4096;
int n;
int olde = errno;
struct bitmask *buffer;
@@ -995,7 +977,7 @@ copy_bitmask_to_nodemask(struct bitmask
if (i >= max)
break;
if (numa_bitmask_isbitset(bmp, i))
- nodemask_set_v1((nodemask_t *)nmp, i);
+ nodemask_set_compat((nodemask_t *)nmp, i);
}
}
@@ -1034,7 +1016,7 @@ copy_nodemask_to_bitmask(nodemask_t *nmp
if (max > bmp->size)
max = bmp->size;
for (i=0; i<max; i++) {
- if (nodemask_isset_v1(nmp, i))
+ if (nodemask_isset_compat(nmp, i))
numa_bitmask_setbit(bmp, i);
}
}
@@ -1329,7 +1311,7 @@ numa_run_on_node_mask_v1(const nodemask_
for (i = 0; i < NUMA_NUM_NODES; i++) {
if (mask->n[i / BITS_PER_LONG] == 0)
continue;
- if (nodemask_isset_v1(mask, i)) {
+ if (nodemask_isset_compat(mask, i)) {
if (numa_node_to_cpus_v1_int(i, nodecpus, CPU_BYTES(ncpus)) < 0) {
numa_warn(W_noderunmask,
"Cannot read node cpumask from sysfs");
diff -Nurp numactl-2.0.2/numacompat1.h numactl-2.0.3-rc1/numacompat1.h
--- numactl-2.0.2/numacompat1.h 2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.3-rc1/numacompat1.h 2008-11-20 00:54:06.000000000 +0100
@@ -11,3 +11,8 @@
#define numa_sched_getaffinity(p,l,m) numa_sched_getaffinity_compat(p,l,m)
#define numa_sched_setaffinity(p,l,m) numa_sched_setaffinity_compat(p,l,m)
#define numa_node_to_cpus(n,b,bl) numa_node_to_cpus_compat(n,b,bl)
+#define nodemask_zero(m) nodemask_zero_compat(m)
+#define nodemask_set(m, n) nodemask_set_compat(m, n)
+#define nodemask_clr(m, n) nodemask_clr_compat(m, n)
+#define nodemask_isset(m, n) nodemask_isset_compat(m, n)
+#define nodemask_equal(a, b) nodemask_equal_compat(a, b)
diff -Nurp numactl-2.0.2/numa.h numactl-2.0.3-rc1/numa.h
--- numactl-2.0.2/numa.h 2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.3-rc1/numa.h 2008-11-20 00:54:06.000000000 +0100
@@ -61,14 +61,48 @@ void copy_bitmask_to_nodemask(struct bit
void copy_bitmask_to_bitmask(struct bitmask *, struct bitmask *);
/* compatibility for codes that used them: */
-static inline void nodemask_zero(struct bitmask *mask)
+static inline void nodemask_zero_compat(nodemask_t *mask)
{
- numa_bitmask_clearall(mask);
+ struct bitmask tmp;
+
+ tmp.maskp = (unsigned long *)mask;
+ tmp.size = sizeof(nodemask_t) * 8;
+ numa_bitmask_clearall(&tmp);
}
-static inline int nodemask_equal(struct bitmask *a, struct bitmask *b)
+static inline void nodemask_set_compat(nodemask_t *mask, int node)
+{
+ mask->n[node / (8*sizeof(unsigned long))] |=
+ (1UL<<(node%(8*sizeof(unsigned long))));
+}
+
+static inline void nodemask_clr_compat(nodemask_t *mask, int node)
+{
+ mask->n[node / (8*sizeof(unsigned long))] &=
+ ~(1UL<<(node%(8*sizeof(unsigned long))));
+}
+
+static inline int nodemask_isset_compat(const nodemask_t *mask, int node)
+{
+ if ((unsigned)node >= NUMA_NUM_NODES)
+ return 0;
+ if (mask->n[node / (8*sizeof(unsigned long))] &
+ (1UL<<(node%(8*sizeof(unsigned long)))))
+ return 1;
+ return 0;
+}
+
+static inline int nodemask_equal_compat(const nodemask_t *a, const nodemask_t *b)
{
- return numa_bitmask_equal(a, b);
+ struct bitmask tmp_a, tmp_b;
+
+ tmp_a.maskp = (unsigned long *)a;
+ tmp_a.size = sizeof(nodemask_t) * 8;
+
+ tmp_b.maskp = (unsigned long *)b;
+ tmp_b.size = sizeof(nodemask_t) * 8;
+
+ return numa_bitmask_equal(&tmp_a, &tmp_b);
}
/* NUMA support available. If this returns a negative value all other function
diff -Nurp numactl-2.0.2/README numactl-2.0.3-rc1/README
--- numactl-2.0.2/README 2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.3-rc1/README 2008-11-20 00:54:06.000000000 +0100
@@ -31,7 +31,7 @@ you might need to pay attention there or
It also uses a public domain Mersenne Twister implementation from
Michael Brundage.
-Version 2.0.0: (C) 2008 SGI
+Version 2.0.3-rc1: (C) 2008 SGI
Author:
Andi Kleen, SUSE Labs