From 4d2d9cec5a82c80e0cabb1c4fc0473aca0cc5a09 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Tue, 17 May 2016 17:43:30 -0700 Subject: [PATCH] Merge chunk_alloc_base() into its only caller. --- include/jemalloc/internal/chunk.h | 1 - include/jemalloc/internal/private_symbols.txt | 1 - src/base.c | 10 +++++++++- src/chunk.c | 20 ------------------- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/include/jemalloc/internal/chunk.h b/include/jemalloc/internal/chunk.h index 05cf3d05..ab102d2c 100644 --- a/include/jemalloc/internal/chunk.h +++ b/include/jemalloc/internal/chunk.h @@ -55,7 +55,6 @@ chunk_hooks_t chunk_hooks_set(tsdn_t *tsdn, arena_t *arena, bool chunk_register(tsdn_t *tsdn, const extent_t *extent); void chunk_deregister(tsdn_t *tsdn, const extent_t *extent); void chunk_reregister(tsdn_t *tsdn, const extent_t *extent); -void *chunk_alloc_base(size_t size); void *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment, bool *zero, bool dalloc_extent); diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt index b3d18600..c237ab33 100644 --- a/include/jemalloc/internal/private_symbols.txt +++ b/include/jemalloc/internal/private_symbols.txt @@ -154,7 +154,6 @@ bootstrap_free bootstrap_malloc bt_init buferror -chunk_alloc_base chunk_alloc_cache chunk_alloc_dss chunk_alloc_mmap diff --git a/src/base.c b/src/base.c index 8816738c..518f966c 100644 --- a/src/base.c +++ b/src/base.c @@ -50,7 +50,15 @@ base_chunk_alloc(tsdn_t *tsdn, size_t minsize) /* Allocate enough space to also carve an extent out if necessary. */ nsize = (extent == NULL) ? CACHELINE_CEILING(sizeof(extent_t)) : 0; csize = CHUNK_CEILING(minsize + nsize); - addr = chunk_alloc_base(csize); + /* + * Directly call chunk_alloc_mmap() because it's critical to allocate + * untouched demand-zeroed virtual memory. + */ + { + bool zero = true; + bool commit = true; + addr = chunk_alloc_mmap(NULL, csize, chunksize, &zero, &commit); + } if (addr == NULL) { if (extent != NULL) base_extent_dalloc(tsdn, extent); diff --git a/src/chunk.c b/src/chunk.c index 2463028b..a32eede9 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -469,26 +469,6 @@ chunk_alloc_core(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size, return (NULL); } -void * -chunk_alloc_base(size_t size) -{ - void *ret; - bool zero, commit; - - /* - * Directly call chunk_alloc_mmap() rather than chunk_alloc_core() - * because it's critical that chunk_alloc_base() return untouched - * demand-zeroed virtual memory. - */ - zero = true; - commit = true; - ret = chunk_alloc_mmap(NULL, size, chunksize, &zero, &commit); - if (ret == NULL) - return (NULL); - - return (ret); -} - void * chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment, bool *zero,