This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: avoid main_arena
- 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 com>
- Date: Mon, 25 Jan 2016 16:25:12 -0800
- Subject: [PATCH] malloc: avoid main_arena
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
In spite of using MAP_HUGETLB we still had memory allocated in small
pages. One cause is the main_arena, which uses sbrk() to allocate
memory. By removing it from the per-numa lists we should minimize use
of the main_arena, while keeping it around for special-purpose
allocations around fork time, etc.
JIRA: PURE-27597
---
tpc/malloc2.13/arena.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tpc/malloc2.13/arena.h b/tpc/malloc2.13/arena.h
index d66b4e7029a2..0ee6286bf286 100644
--- a/tpc/malloc2.13/arena.h
+++ b/tpc/malloc2.13/arena.h
@@ -354,9 +354,9 @@ static void ptmalloc_init(void)
#endif /* !defined NO_THREADS */
mutex_init(&main_arena.mutex);
main_arena.next = &main_arena;
- numa_arena[0] = &main_arena;
+ main_arena.numa_node = -1;
parse_node_count();
- for (i = 1; i <= max_node; i++) {
+ for (i = 0; i <= max_node; i++) {
numa_arena[i] = _int_new_arena(0, i);
numa_arena[i]->local_next = numa_arena[i];
(void)mutex_unlock(&numa_arena[i]->mutex);
--
2.7.0.rc3