Skip to content

Fix # of unpurged pages in decay algorithm. - #845

Merged
interwq merged 1 commit into
jemalloc:devfrom
interwq:decay
May 23, 2017
Merged

interwq merged 1 commit into
jemalloc:devfrom
interwq:decay

Conversation

@interwq

@interwq interwq commented May 22, 2017 •

Copy link
Copy Markdown
Contributor

When # of dirty pages move below npages_limit (e.g. they are reused), we should
not lower number of unpurged pages because that would cause the reused pages to
be double counted in the backlog (as a result, decay happen slower than it
should). Instead, set number of unpurged to the greater of current npages and
npages_limit.

Added an assertion: peak # of pages should be greater than npages_limit.

This resolves #813.

Comment thread src/background_thread.c
nstime_t before_sleep;
nstime_init2(&before_sleep, tv.tv_sec, tv.tv_usec * 1000);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will rebase to fix this.

@interwq

interwq commented May 22, 2017

Copy link
Copy Markdown
Contributor Author

Only last commit is relevant here. This is on top of #714.

@interwq
interwq requested a review from jasone May 22, 2017 20:20
Comment thread src/arena.c Outdated
if (ndirty > decay->peak_npages) {
decay->peak_npages = ndirty;
}
assert(decay->peak_npages >=

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unnecessarily weak assertion. Can we change peak_npages to be a ceiling, so that the assertion is relevant more of the time?

if (config_debug) {
        if (ndirty > decay->ceil_npages) {
                decay->ceil_npages = ndirty;
        }
        size_t npages_limit =
            arena_decay_backlog_npages_limit(decay);
        assert(decay->ceil_npages >= npages_limit);
        if (decay->ceil_npages > npages_limit) {
                decay->ceil_npages = npages_limit;
        }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will change.

Comment thread src/arena.c Outdated
* machinery correctness.
*/
decay->nunpurged = extents_npages_get(extents);
decay->nunpurged = npages_limit > current_npages ? npages_limit :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parentheses around the conditional help readability.

@interwq interwq added the bug label May 23, 2017
@interwq interwq added this to the 5.0.0 milestone May 23, 2017
When # of dirty pages move below npages_limit (e.g. they are reused), we should
not lower number of unpurged pages because that would cause the reused pages to
be double counted in the backlog (as a result, decay happen slower than it
should).  Instead, set number of unpurged to the greater of current npages and
npages_limit.

Added an assertion: the ceiling # of pages should be greater than npages_limit.
@interwq

interwq commented May 23, 2017

Copy link
Copy Markdown
Contributor Author

All tests passed previously. Landing.

@interwq
interwq merged commit eeefdf3 into jemalloc:dev May 23, 2017
@interwq
interwq deleted the decay branch May 23, 2017 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decay algorithm adjustment

2 participants