arena->npurgatory is no longer needed since we drop arena's lock

after stashing all the purgeable runs.
This commit is contained in:
Qinfan Wu 2014-07-21 20:00:14 -07:00
parent 90737fcda1
commit e8a2fd83a2
2 changed files with 3 additions and 20 deletions

View File

@ -343,14 +343,6 @@ struct arena_s {
*/ */
size_t ndirty; size_t ndirty;
/*
* Approximate number of pages being purged. It is possible for
* multiple threads to purge dirty pages concurrently, and they use
* npurgatory to indicate the total number of pages all threads are
* attempting to purge.
*/
size_t npurgatory;
/* /*
* Size/address-ordered trees of this arena's available runs. The trees * Size/address-ordered trees of this arena's available runs. The trees
* are used for first-best-fit run allocation. * are used for first-best-fit run allocation.

View File

@ -757,10 +757,7 @@ arena_maybe_purge(arena_t *arena)
/* Don't purge if the option is disabled. */ /* Don't purge if the option is disabled. */
if (opt_lg_dirty_mult < 0) if (opt_lg_dirty_mult < 0)
return; return;
/* Don't purge if all dirty pages are already being purged. */ npurgeable = arena->ndirty;
if (arena->ndirty <= arena->npurgatory)
return;
npurgeable = arena->ndirty - arena->npurgatory;
threshold = (arena->nactive >> opt_lg_dirty_mult); threshold = (arena->nactive >> opt_lg_dirty_mult);
/* /*
* Don't purge unless the number of purgeable pages exceeds the * Don't purge unless the number of purgeable pages exceeds the
@ -803,7 +800,7 @@ arena_compute_npurgatory(arena_t *arena, bool all)
* Compute the minimum number of pages that this thread should try to * Compute the minimum number of pages that this thread should try to
* purge. * purge.
*/ */
npurgeable = arena->ndirty - arena->npurgatory; npurgeable = arena->ndirty;
if (all == false) { if (all == false) {
size_t threshold = (arena->nactive >> opt_lg_dirty_mult); size_t threshold = (arena->nactive >> opt_lg_dirty_mult);
@ -942,9 +939,7 @@ arena_purge(arena_t *arena, bool all)
size_t ndirty = arena_dirty_count(arena); size_t ndirty = arena_dirty_count(arena);
assert(ndirty == arena->ndirty); assert(ndirty == arena->ndirty);
} }
assert(arena->ndirty > arena->npurgatory || all); assert((arena->nactive >> opt_lg_dirty_mult) < arena->ndirty || all);
assert((arena->nactive >> opt_lg_dirty_mult) < (arena->ndirty -
arena->npurgatory) || all);
if (config_stats) if (config_stats)
arena->stats.npurge++; arena->stats.npurge++;
@ -955,14 +950,11 @@ arena_purge(arena_t *arena, bool all)
* reduce ndirty below the threshold. * reduce ndirty below the threshold.
*/ */
npurgatory = arena_compute_npurgatory(arena, all); npurgatory = arena_compute_npurgatory(arena, all);
arena->npurgatory += npurgatory;
ql_new(&purge_list); ql_new(&purge_list);
npurgeable = arena_stash_dirty(arena, all, npurgatory, &purge_list); npurgeable = arena_stash_dirty(arena, all, npurgatory, &purge_list);
assert(npurgeable >= npurgatory); assert(npurgeable >= npurgatory);
/* Actually we no longer need arena->npurgatory. */
arena->npurgatory -= npurgatory;
npurged = arena_purge_stashed(arena, &purge_list); npurged = arena_purge_stashed(arena, &purge_list);
assert(npurged == npurgeable); assert(npurged == npurgeable);
@ -2251,7 +2243,6 @@ arena_new(arena_t *arena, unsigned ind)
arena->nactive = 0; arena->nactive = 0;
arena->ndirty = 0; arena->ndirty = 0;
arena->npurgatory = 0;
arena_avail_tree_new(&arena->runs_avail); arena_avail_tree_new(&arena->runs_avail);