mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
2914297216
Pre-populating page cache improves the latency of swap-in which I/O wait mostly have taken up. This was because page cache populations were triggered on page fault basis. Since swap-in operation moves pages sequentially, pre-populating has a benefit on the latency. MADV_WILLNEED causes the kernel to asynchronously start populating the pages, and MLOCK_ONFAULT ensures that the data remains in the page cache until it is UFFD_COPYed. mlock(2) without MLOCK_ONFAULT is not applicable because it blocks the calling thread until populated. MADV_DONTNEED is also important in terms of the swap-in latency. It frees the page cache which is already UFFD_COPYed to be reused for later readaheading swap file. Otherwise the memory pressure from the swap file page cache population triggers system-wide page frame collection which is heavy. Pre-populating page cache alone is actually not enough to improve the swap-in latency without swapping in on a background thread (https://crrev.com/c/4317028). BUG=b:265606668 TEST=cargo test -p swap Change-Id: I2069c1260d0cf45499298999a71621e563f28f30 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4314186 Reviewed-by: David Stevens <stevensd@chromium.org> Commit-Queue: Shin Kawamura <kawasin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |