Merge chunk_alloc_base() into its only caller.

This commit is contained in:
Jason Evans 2016-05-17 17:43:30 -07:00
parent fc0372a15e
commit 4d2d9cec5a
4 changed files with 9 additions and 23 deletions

View File

@ -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); bool chunk_register(tsdn_t *tsdn, const extent_t *extent);
void chunk_deregister(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_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, void *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment, chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
bool *zero, bool dalloc_extent); bool *zero, bool dalloc_extent);

View File

@ -154,7 +154,6 @@ bootstrap_free
bootstrap_malloc bootstrap_malloc
bt_init bt_init
buferror buferror
chunk_alloc_base
chunk_alloc_cache chunk_alloc_cache
chunk_alloc_dss chunk_alloc_dss
chunk_alloc_mmap chunk_alloc_mmap

View File

@ -50,7 +50,15 @@ base_chunk_alloc(tsdn_t *tsdn, size_t minsize)
/* Allocate enough space to also carve an extent out if necessary. */ /* Allocate enough space to also carve an extent out if necessary. */
nsize = (extent == NULL) ? CACHELINE_CEILING(sizeof(extent_t)) : 0; nsize = (extent == NULL) ? CACHELINE_CEILING(sizeof(extent_t)) : 0;
csize = CHUNK_CEILING(minsize + nsize); 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 (addr == NULL) {
if (extent != NULL) if (extent != NULL)
base_extent_dalloc(tsdn, extent); base_extent_dalloc(tsdn, extent);

View File

@ -469,26 +469,6 @@ chunk_alloc_core(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
return (NULL); 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 * void *
chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, 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, void *new_addr, size_t size, size_t alignment, bool *zero,