This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc: avoid main_arena


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]