Refactor chunk_purge_wrapper() to take extent argument.

This commit is contained in:
Jason Evans 2016-05-23 15:10:25 -07:00
parent 0eb6f08959
commit 5c6be2bdd3
4 changed files with 10 additions and 12 deletions

View File

@ -67,8 +67,7 @@ bool chunk_commit_wrapper(tsdn_t *tsdn, arena_t *arena,
bool chunk_decommit_wrapper(tsdn_t *tsdn, arena_t *arena, bool chunk_decommit_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, extent_t *extent, size_t offset, size_t length); chunk_hooks_t *chunk_hooks, extent_t *extent, size_t offset, size_t length);
bool chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena, bool chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t offset, chunk_hooks_t *chunk_hooks, extent_t *extent, size_t offset, size_t length);
size_t length);
extent_t *chunk_split_wrapper(tsdn_t *tsdn, arena_t *arena, extent_t *chunk_split_wrapper(tsdn_t *tsdn, arena_t *arena,
chunk_hooks_t *chunk_hooks, extent_t *extent, size_t size_a, size_t size_b); chunk_hooks_t *chunk_hooks, extent_t *extent, size_t size_a, size_t size_b);
bool chunk_merge_wrapper(tsdn_t *tsdn, arena_t *arena, bool chunk_merge_wrapper(tsdn_t *tsdn, arena_t *arena,

View File

@ -1542,8 +1542,8 @@ arena_purge_stashed(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
flags = CHUNK_MAP_DECOMMITTED; flags = CHUNK_MAP_DECOMMITTED;
} else { } else {
flag_unzeroed = chunk_purge_wrapper(tsdn, arena, flag_unzeroed = chunk_purge_wrapper(tsdn, arena,
chunk_hooks, chunk, chunksize, pageind << chunk_hooks, extent, pageind << LG_PAGE,
LG_PAGE, run_size) ? CHUNK_MAP_UNZEROED : 0; run_size) ? CHUNK_MAP_UNZEROED : 0;
flags = flag_unzeroed; flags = flag_unzeroed;
} }
arena_mapbits_large_set(chunk, pageind+npages-1, 0, arena_mapbits_large_set(chunk, pageind+npages-1, 0,

View File

@ -281,8 +281,7 @@ chunk_leak(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, bool cache,
* that this is only a virtual memory leak. * that this is only a virtual memory leak.
*/ */
if (cache) { if (cache) {
chunk_purge_wrapper(tsdn, arena, chunk_hooks, chunk_purge_wrapper(tsdn, arena, chunk_hooks, extent, 0,
extent_addr_get(extent), extent_size_get(extent), 0,
extent_size_get(extent)); extent_size_get(extent));
} }
extent_dalloc(tsdn, arena, extent); extent_dalloc(tsdn, arena, extent);
@ -739,11 +738,13 @@ chunk_purge_default(void *chunk, size_t size, size_t offset, size_t length,
bool bool
chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks, chunk_purge_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); chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks);
return (chunk_hooks->purge(chunk, size, offset, length, arena->ind)); return (chunk_hooks->purge(extent_addr_get(extent),
CHUNK_CEILING(extent_size_get(extent)), offset, length,
arena->ind));
} }
static bool static bool

View File

@ -115,8 +115,7 @@ huge_ralloc_no_move_similar(tsdn_t *tsdn, extent_t *extent, size_t usize_min,
post_zeroed = false; post_zeroed = false;
} else { } else {
post_zeroed = !chunk_purge_wrapper(tsdn, arena, post_zeroed = !chunk_purge_wrapper(tsdn, arena,
&chunk_hooks, extent_addr_get(extent), &chunk_hooks, extent, usize, sdiff);
CHUNK_CEILING(oldsize), usize, sdiff);
} }
} else } else
post_zeroed = pre_zeroed; post_zeroed = pre_zeroed;
@ -183,8 +182,7 @@ huge_ralloc_no_move_shrink(tsdn_t *tsdn, extent_t *extent, size_t usize)
post_zeroed = false; post_zeroed = false;
} else { } else {
post_zeroed = !chunk_purge_wrapper(tsdn, arena, post_zeroed = !chunk_purge_wrapper(tsdn, arena,
&chunk_hooks, extent_addr_get(extent), &chunk_hooks, extent, usize, sdiff);
CHUNK_CEILING(usize), usize, sdiff);
if (config_fill && unlikely(opt_zero) && !post_zeroed) { if (config_fill && unlikely(opt_zero) && !post_zeroed) {
memset((void *) memset((void *)