mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-21 03:15:38 +03:00
Add output argument to hpa_purge_begin to count dirty ranges
This commit is contained in:
parent
cdf72dda56
commit
925d7b3cf5
5 changed files with 27 additions and 9 deletions
|
|
@ -69,8 +69,10 @@ TEST_BEGIN(test_purge_simple) {
|
|||
|
||||
hpdata_alloc_allowed_set(&hpdata, false);
|
||||
hpdata_purge_state_t purge_state;
|
||||
size_t to_purge = hpdata_purge_begin(&hpdata, &purge_state);
|
||||
size_t nranges;
|
||||
size_t to_purge = hpdata_purge_begin(&hpdata, &purge_state, &nranges);
|
||||
expect_zu_eq(HUGEPAGE_PAGES / 4, to_purge, "");
|
||||
expect_zu_eq(1, nranges, "All dirty pages in a single range");
|
||||
|
||||
void *purge_addr;
|
||||
size_t purge_size;
|
||||
|
|
@ -113,8 +115,10 @@ TEST_BEGIN(test_purge_intervening_dalloc) {
|
|||
|
||||
hpdata_alloc_allowed_set(&hpdata, false);
|
||||
hpdata_purge_state_t purge_state;
|
||||
size_t to_purge = hpdata_purge_begin(&hpdata, &purge_state);
|
||||
size_t nranges;
|
||||
size_t to_purge = hpdata_purge_begin(&hpdata, &purge_state, &nranges);
|
||||
expect_zu_eq(HUGEPAGE_PAGES / 2, to_purge, "");
|
||||
expect_zu_eq(2, nranges, "First quarter and last half");
|
||||
|
||||
void *purge_addr;
|
||||
size_t purge_size;
|
||||
|
|
@ -171,8 +175,10 @@ TEST_BEGIN(test_purge_over_retained) {
|
|||
/* Purge the second quarter. */
|
||||
hpdata_alloc_allowed_set(&hpdata, false);
|
||||
hpdata_purge_state_t purge_state;
|
||||
size_t to_purge_dirty = hpdata_purge_begin(&hpdata, &purge_state);
|
||||
size_t nranges;
|
||||
size_t to_purge_dirty = hpdata_purge_begin(&hpdata, &purge_state, &nranges);
|
||||
expect_zu_eq(HUGEPAGE_PAGES / 4, to_purge_dirty, "");
|
||||
expect_zu_eq(1, nranges, "Second quarter only");
|
||||
|
||||
bool got_result = hpdata_purge_next(&hpdata, &purge_state, &purge_addr,
|
||||
&purge_size);
|
||||
|
|
@ -199,8 +205,9 @@ TEST_BEGIN(test_purge_over_retained) {
|
|||
* re-purge it. We expect a single purge of 3/4 of the hugepage,
|
||||
* purging half its pages.
|
||||
*/
|
||||
to_purge_dirty = hpdata_purge_begin(&hpdata, &purge_state);
|
||||
to_purge_dirty = hpdata_purge_begin(&hpdata, &purge_state, &nranges);
|
||||
expect_zu_eq(HUGEPAGE_PAGES / 2, to_purge_dirty, "");
|
||||
expect_zu_eq(1, nranges, "Single range expected");
|
||||
|
||||
got_result = hpdata_purge_next(&hpdata, &purge_state, &purge_addr,
|
||||
&purge_size);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ static void
|
|||
test_psset_fake_purge(hpdata_t *ps) {
|
||||
hpdata_purge_state_t purge_state;
|
||||
hpdata_alloc_allowed_set(ps, false);
|
||||
hpdata_purge_begin(ps, &purge_state);
|
||||
size_t nranges;
|
||||
hpdata_purge_begin(ps, &purge_state, &nranges);
|
||||
(void) nranges;
|
||||
void *addr;
|
||||
size_t size;
|
||||
while (hpdata_purge_next(ps, &purge_state, &addr, &size)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue