diff options
author | Jason Evans <jasone@canonware.com> | 2016-05-23 22:04:40 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-06-03 19:27:41 (GMT) |
commit | 0eb6f08959700428f3ae0df1d8ab1cd7bd4c82bc (patch) | |
tree | 6d2bcd896095b7c3d57c235c556d5ace174fbc0d /src | |
parent | 6c944708222b3f1843ad224c88ffdafa02da1bb8 (diff) | |
download | jemalloc-0eb6f08959700428f3ae0df1d8ab1cd7bd4c82bc.zip jemalloc-0eb6f08959700428f3ae0df1d8ab1cd7bd4c82bc.tar.gz jemalloc-0eb6f08959700428f3ae0df1d8ab1cd7bd4c82bc.tar.bz2 |
Refactor chunk_[de]commit_wrapper() to take extent arguments.
Diffstat (limited to 'src')
-rw-r--r-- | src/arena.c | 14 | ||||
-rw-r--r-- | src/chunk.c | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/arena.c b/src/arena.c index 9eb0897..2479354 100644 --- a/src/arena.c +++ b/src/arena.c @@ -440,7 +440,7 @@ arena_run_split_large_helper(tsdn_t *tsdn, arena_t *arena, extent_t *extent, assert(need_pages > 0); if (flag_decommitted != 0 && chunk_commit_wrapper(tsdn, arena, - &arena->chunk_hooks, chunk, chunksize, run_ind << LG_PAGE, size)) + &arena->chunk_hooks, extent, run_ind << LG_PAGE, size)) return (true); if (remove) { @@ -523,7 +523,7 @@ arena_run_split_small(tsdn_t *tsdn, arena_t *arena, extent_t *extent, assert(need_pages > 0); if (flag_decommitted != 0 && chunk_commit_wrapper(tsdn, arena, - &arena->chunk_hooks, chunk, chunksize, run_ind << LG_PAGE, size)) + &arena->chunk_hooks, extent, run_ind << LG_PAGE, size)) return (true); arena_run_split_remove(arena, chunk, run_ind, flag_dirty, @@ -578,8 +578,7 @@ arena_chunk_alloc_internal_hard(tsdn_t *tsdn, arena_t *arena, chunksize, zero, commit); if (extent != NULL && !*commit) { /* Commit header. */ - if (chunk_commit_wrapper(tsdn, arena, chunk_hooks, - extent_addr_get(extent), extent_size_get(extent), 0, + if (chunk_commit_wrapper(tsdn, arena, chunk_hooks, extent, 0, map_bias << LG_PAGE)) { chunk_dalloc_wrapper(tsdn, arena, chunk_hooks, extent); extent = NULL; @@ -708,8 +707,7 @@ arena_chunk_discard(tsdn_t *tsdn, arena_t *arena, extent_t *extent) * chunk as committed has a high potential for causing later * access of decommitted memory. */ - chunk_decommit_wrapper(tsdn, arena, &chunk_hooks, - extent_addr_get(extent), extent_size_get(extent), 0, + chunk_decommit_wrapper(tsdn, arena, &chunk_hooks, extent, 0, map_bias << LG_PAGE); } @@ -1537,8 +1535,8 @@ arena_purge_stashed(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, assert(!arena_mapbits_decommitted_get(chunk, pageind+npages-1)); decommitted = !chunk_decommit_wrapper(tsdn, arena, - chunk_hooks, chunk, chunksize, pageind << LG_PAGE, - npages << LG_PAGE); + chunk_hooks, extent, pageind << LG_PAGE, npages << + LG_PAGE); if (decommitted) { flag_unzeroed = 0; flags = CHUNK_MAP_DECOMMITTED; diff --git a/src/chunk.c b/src/chunk.c index d076321..363ce8f 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -695,11 +695,12 @@ chunk_commit_default(void *chunk, size_t size, size_t offset, size_t length, bool chunk_commit_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, - void *chunk, size_t size, size_t offset, size_t length) + extent_t *extent, size_t offset, size_t length) { chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks); - return (chunk_hooks->commit(chunk, size, offset, length, arena->ind)); + return (chunk_hooks->commit(extent_addr_get(extent), + extent_size_get(extent), offset, length, arena->ind)); } static bool @@ -713,11 +714,12 @@ chunk_decommit_default(void *chunk, size_t size, size_t offset, size_t length, bool chunk_decommit_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, - void *chunk, size_t size, size_t offset, size_t length) + extent_t *extent, size_t offset, size_t length) { chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks); - return (chunk_hooks->decommit(chunk, size, offset, length, arena->ind)); + return (chunk_hooks->decommit(extent_addr_get(extent), + extent_size_get(extent), offset, length, arena->ind)); } static bool |