Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page eviction and simple mm service routine #1140

Merged
merged 2 commits into from
Apr 23, 2020
Merged

page eviction and simple mm service routine #1140

merged 2 commits into from
Apr 23, 2020

Conversation

wjhun
Copy link
Contributor

@wjhun wjhun commented Apr 22, 2020

Add drain function to pagecache to evict cached pages. The mm_service routine, called from runloop_internal, simply checks if free physical memory dips below a threshold (CACHE_DRAIN_CUTOFF) and calls the pagecache drain with the delta.

Clearly more can be done to address low memory situations (#1130). Perhaps we could chain drain functions for various caches in the system (of varying types - including object caches) and drain according to some priority scheme. And a low memory threshold could be something more intelligent - a proportion of total memory or something determined dynamically. But a fixed threshold is better than not draining the pagecache at all.

There isn't a runtime test to stress the cache or page eviction. To test these changes, I raised CACHE_DRAIN_CUTOFF to various levels (up to system memory) to force drainage while running 'make test' and a go webserver serving large files.

Also fixes a missing sg_buf release in sendfile(2).

Resolves #1117, partially addresses #1130

@wjhun wjhun requested a review from a team April 22, 2020 18:23
@wjhun wjhun changed the title pagecache eviction and simplistic "mm service" to cull pages pagecache page eviction and simplistic "mm service" to cull pages Apr 22, 2020
@wjhun wjhun changed the title pagecache page eviction and simplistic "mm service" to cull pages page eviction and simple mm service routine Apr 22, 2020
src/unix/syscall.c Outdated Show resolved Hide resolved
src/x86_64/service.c Outdated Show resolved Hide resolved
@wjhun wjhun force-pushed the page-cache-drain branch from 148d979 to 23bfde3 Compare April 23, 2020 14:34
@wjhun wjhun force-pushed the page-cache-drain branch from 23bfde3 to 12e8862 Compare April 23, 2020 14:59
@wjhun wjhun merged commit 110bed8 into master Apr 23, 2020
@wjhun wjhun deleted the page-cache-drain branch May 5, 2020 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

future work page cache / page reclaim/drain /
2 participants