This is the mail archive of the 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: speed up mmap

MAP_POPULATE might actually slow down the mmap proper, but it will speed
up all subsequent operations, including the memset().  And shrinking the
size of memset to the size of malloc headers - one for the heap and one
for the arena - should be somewhat faster then clearing all 64MB.  Even
at 10GB/s we save 6ms.
JIRA: PURE-46853
 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 e53076d213b2..c959b77b9e9d 100644
--- a/tpc/malloc2.13/arena.h
+++ b/tpc/malloc2.13/arena.h
@@ -379,7 +379,7 @@ static char *aligned_heap_area;
 static void *mmap_for_heap(void *addr, size_t length, int *must_clear)
 	int prot = PROT_READ | PROT_WRITE;
-	int flags = MAP_PRIVATE;
 	void *ret;
 	ret = MMAP(addr, length, prot, flags | MAP_HUGETLB);
@@ -462,7 +462,7 @@ static heap_info *new_heap(size_t size, size_t top_pad, int numa_node)
 	mbind_memory(p2, HEAP_MAX_SIZE, numa_node);
 	if (must_clear)
-		memset(p2, 0, HEAP_MAX_SIZE);
+		memset(p2, 0, sizeof(heap_info) + sizeof(struct malloc_state));
 	h = (heap_info *) p2;
 	h->size = size;
 	h->mprotect_size = size;

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