This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: fix mbind on old kernels
- From: Joern Engel <joern at purestorage dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, Joern Engel <joern at purestorage dot org>
- Date: Mon, 25 Jan 2016 16:25:06 -0800
- Subject: [PATCH] malloc: fix mbind on old kernels
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
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