mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-06 12:14:22 +03:00
Implement two-phase decay-based purging.
Split decay-based purging into two phases, the first of which uses lazy
purging to convert dirty pages to "muzzy", and the second of which uses
forced purging, decommit, or unmapping to convert pages to clean or
destroy them altogether. Not all operating systems support lazy
purging, yet the application may provide extent hooks that implement
lazy purging, so care must be taken to dynamically omit the first phase
when necessary.
The mallctl interfaces change as follows:
- opt.decay_time --> opt.{dirty,muzzy}_decay_time
- arena.<i>.decay_time --> arena.<i>.{dirty,muzzy}_decay_time
- arenas.decay_time --> arenas.{dirty,muzzy}_decay_time
- stats.arenas.<i>.pdirty --> stats.arenas.<i>.p{dirty,muzzy}
- stats.arenas.<i>.{npurge,nmadvise,purged} -->
stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged}
This resolves #521.
This commit is contained in:
parent
38a5bfc816
commit
64e458f5cd
23 changed files with 1078 additions and 490 deletions
|
|
@ -71,7 +71,8 @@ TEST_BEGIN(test_stats_arenas_summary) {
|
|||
size_t sz;
|
||||
int expected = config_stats ? 0 : ENOENT;
|
||||
size_t mapped;
|
||||
uint64_t npurge, nmadvise, purged;
|
||||
uint64_t dirty_npurge, dirty_nmadvise, dirty_purged;
|
||||
uint64_t muzzy_npurge, muzzy_nmadvise, muzzy_purged;
|
||||
|
||||
little = mallocx(SMALL_MAXCLASS, MALLOCX_ARENA(0));
|
||||
assert_ptr_not_null(little, "Unexpected mallocx() failure");
|
||||
|
|
@ -92,19 +93,34 @@ TEST_BEGIN(test_stats_arenas_summary) {
|
|||
sz = sizeof(size_t);
|
||||
assert_d_eq(mallctl("stats.arenas.0.mapped", (void *)&mapped, &sz, NULL,
|
||||
0), expected, "Unexepected mallctl() result");
|
||||
|
||||
sz = sizeof(uint64_t);
|
||||
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge, &sz, NULL,
|
||||
0), expected, "Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.nmadvise", (void *)&nmadvise, &sz,
|
||||
NULL, 0), expected, "Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.purged", (void *)&purged, &sz, NULL,
|
||||
0), expected, "Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.dirty_npurge",
|
||||
(void *)&dirty_npurge, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.dirty_nmadvise",
|
||||
(void *)&dirty_nmadvise, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.dirty_purged",
|
||||
(void *)&dirty_purged, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.muzzy_npurge",
|
||||
(void *)&muzzy_npurge, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.muzzy_nmadvise",
|
||||
(void *)&muzzy_nmadvise, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
assert_d_eq(mallctl("stats.arenas.0.muzzy_purged",
|
||||
(void *)&muzzy_purged, &sz, NULL, 0), expected,
|
||||
"Unexepected mallctl() result");
|
||||
|
||||
if (config_stats) {
|
||||
assert_u64_gt(npurge, 0,
|
||||
assert_u64_gt(dirty_npurge + muzzy_npurge, 0,
|
||||
"At least one purge should have occurred");
|
||||
assert_u64_le(nmadvise, purged,
|
||||
"nmadvise should be no greater than purged");
|
||||
assert_u64_le(dirty_nmadvise, dirty_purged,
|
||||
"dirty_nmadvise should be no greater than dirty_purged");
|
||||
assert_u64_le(muzzy_nmadvise, muzzy_purged,
|
||||
"muzzy_nmadvise should be no greater than muzzy_purged");
|
||||
}
|
||||
}
|
||||
TEST_END
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue