[PATCH] malloc: fix mbind on old kernels
Joern Engel
joern@purestorage.com
Tue Jan 26 00:32:00 GMT 2016
From: Joern Engel <joern@purestorage.org>
Kernel returned -EINVAL when passing in MPOL_F_STATIC_NODES. The flag
being documented in the manpage, yet undefined in the header was dodgy
anyway. Sounds like an intriguing story waiting to be uncovered.
JIRA: PURE-27597
---
tpc/malloc2.13/arena.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tpc/malloc2.13/arena.h b/tpc/malloc2.13/arena.h
index ef5e22a0811d..0804ecfe3a26 100644
--- a/tpc/malloc2.13/arena.h
+++ b/tpc/malloc2.13/arena.h
@@ -466,16 +466,14 @@ static void *mmap_for_heap(void *addr, size_t length, int *must_clear)
}
#include <numaif.h>
-#ifndef MPOL_F_STATIC_NODES
-#define MPOL_F_STATIC_NODES (1 << 15)
-#endif
+
static void mbind_memory(void *mem, size_t size, int node)
{
unsigned long node_mask = 1 << node;
int err;
assert(max_node < sizeof(unsigned long));
- err = mbind(mem, size, MPOL_PREFERRED, &node_mask, max_node, MPOL_F_STATIC_NODES);
+ err = mbind(mem, size, MPOL_PREFERRED, &node_mask, max_node + 1, 0);
assert(!err);
}
--
2.7.0.rc3
More information about the Libc-alpha
mailing list