diff options
author | Jason Evans <jasone@canonware.com> | 2017-01-30 05:57:14 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2017-02-02 00:43:46 (GMT) |
commit | d27f29b468ae3e9d2b1da4a9880351d76e5a1662 (patch) | |
tree | 3e08af312052af381920f629c4edcacd969151bd /test/unit | |
parent | 1b6e43507ed330314fffe0872f48a95a9fe502fe (diff) | |
download | jemalloc-d27f29b468ae3e9d2b1da4a9880351d76e5a1662.zip jemalloc-d27f29b468ae3e9d2b1da4a9880351d76e5a1662.tar.gz jemalloc-d27f29b468ae3e9d2b1da4a9880351d76e5a1662.tar.bz2 |
Disentangle arena and extent locking.
Refactor arena and extent locking protocols such that arena and
extent locks are never held when calling into the extent_*_wrapper()
API. This requires extra care during purging since the arena lock no
longer protects the inner purging logic. It also requires extra care to
protect extents from being merged with adjacent extents.
Convert extent_t's 'active' flag to an enumerated 'state', so that
retained extents are explicitly marked as such, rather than depending on
ring linkage state.
Refactor the extent collections (and their synchronization) for cached
and retained extents into extents_t. Incorporate LRU functionality to
support purging. Incorporate page count accounting, which replaces
arena->ndirty and arena->stats.retained.
Assert that no core locks are held when entering any internal
[de]allocation functions. This is in addition to existing assertions
that no locks are held when entering external [de]allocation functions.
Audit and document synchronization protocols for all arena_t fields.
This fixes a potential deadlock due to recursive allocation during
gdump, in a similar fashion to b49c649bc18fff4bd10a1c8adbaf1f25f6453cb6
(Fix lock order reversal during gdump.), but with a necessarily much
broader code impact.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/arena_reset.c | 2 | ||||
-rw-r--r-- | test/unit/slab.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test/unit/arena_reset.c b/test/unit/arena_reset.c index d2a9bb4..24c7f52 100644 --- a/test/unit/arena_reset.c +++ b/test/unit/arena_reset.c @@ -63,7 +63,7 @@ vsalloc(tsdn_t *tsdn, const void *ptr) { if (extent == NULL) { return 0; } - if (!extent_active_get(extent)) { + if (extent_state_get(extent) != extent_state_active) { return 0; } diff --git a/test/unit/slab.c b/test/unit/slab.c index d3b45e8..1f2a260 100644 --- a/test/unit/slab.c +++ b/test/unit/slab.c @@ -8,8 +8,8 @@ TEST_BEGIN(test_arena_slab_regind) { extent_t slab; const arena_bin_info_t *bin_info = &arena_bin_info[binind]; extent_init(&slab, NULL, mallocx(bin_info->slab_size, - MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, 0, 0, true, - false, true, true); + MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, 0, 0, + extent_state_active, false, true, true); assert_ptr_not_null(extent_addr_get(&slab), "Unexpected malloc() failure"); for (regind = 0; regind < bin_info->nregs; regind++) { |