mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-26 10:37:19 +03:00
Add witness_assert_depth[_to_rank]().
This makes it possible to make lock state assertions about precisely which locks are held.
This commit is contained in:
parent
7034e6baa1
commit
f56cb9a68e
7 changed files with 141 additions and 107 deletions
|
|
@ -62,7 +62,7 @@ huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
|
|||
/* Allocate one or more contiguous chunks for this request. */
|
||||
|
||||
assert(!tsdn_null(tsdn) || arena != NULL);
|
||||
witness_assert_lock_depth(tsdn, 0); /* prof_gdump() requirement. */
|
||||
witness_assert_lockless(tsdn); /* prof_gdump() requirement. */
|
||||
|
||||
ausize = sa2u(usize, alignment);
|
||||
if (unlikely(ausize == 0 || ausize > HUGE_MAXCLASS))
|
||||
|
|
@ -149,7 +149,7 @@ huge_ralloc_no_move_similar(tsdn_t *tsdn, void *ptr, size_t oldsize,
|
|||
chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
|
||||
bool pre_zeroed, post_zeroed, gdump;
|
||||
|
||||
witness_assert_lock_depth(tsdn, 0); /* prof_gdump() requirement. */
|
||||
witness_assert_lockless(tsdn); /* prof_gdump() requirement. */
|
||||
|
||||
/* Increase usize to incorporate extra. */
|
||||
for (usize = usize_min; usize < usize_max && (usize_next = s2u(usize+1))
|
||||
|
|
@ -223,7 +223,7 @@ huge_ralloc_no_move_shrink(tsdn_t *tsdn, void *ptr, size_t oldsize,
|
|||
chunk_hooks = chunk_hooks_get(tsdn, arena);
|
||||
|
||||
assert(oldsize > usize);
|
||||
witness_assert_lock_depth(tsdn, 0); /* prof_gdump() requirement. */
|
||||
witness_assert_lockless(tsdn); /* prof_gdump() requirement. */
|
||||
|
||||
/* Split excess chunks. */
|
||||
cdiff = CHUNK_CEILING(oldsize) - CHUNK_CEILING(usize);
|
||||
|
|
@ -278,7 +278,7 @@ huge_ralloc_no_move_expand(tsdn_t *tsdn, void *ptr, size_t oldsize,
|
|||
is_zeroed_subchunk = extent_node_zeroed_get(node);
|
||||
malloc_mutex_unlock(tsdn, &arena->huge_mtx);
|
||||
|
||||
witness_assert_lock_depth(tsdn, 0); /* prof_gdump() requirement. */
|
||||
witness_assert_lockless(tsdn); /* prof_gdump() requirement. */
|
||||
|
||||
/*
|
||||
* Use is_zeroed_chunk to detect whether the trailing memory is zeroed,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue