Commit graph

4 commits

Author SHA1 Message Date
Shintaro Kawamura
fc88a6091d swap: add disable command to vmm-swap
Handling page faults using userfaultfd for all the time after vmm-swap
is enabled originally has overhead. By disabling swapping, we can use
crosvm without the overhead when the crosvm become used heavily again.

This also refactor PageHandler and extract register logic to lib.rs.

BUG=b:215093219
TEST=cargo test -p swap

Change-Id: Id81d84ebe40067b4f19b212f6b81cbaf249c0c3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4005474
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2022-11-18 01:23:45 +00:00
Shintaro Kawamura
f20622f6fb swap: handle ENOMEM error from userfaultfd
userfaultfd returns ENOMEM on register if the corresponding process is
obsolete (e.g. the process dies, memory space is refleshed by execve).

BUG=b:253555760
TEST=cargo test -p swap

Change-Id: I9a6a7f0ed45cdc91bdf17e5d29e4c215b7f575a5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4025736
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-11-17 02:39:55 +00:00
Shintaro Kawamura
87679c98d2 swap: fix tempdir usage in tests
Directories from TempDir::into_path() are not automatically deleted.
We should use TempDir::path() instead.

BUG=b:253555760
TEST=cargo test -p swap

Change-Id: I9f0c5398a7eaa16317f9e40f16231f9b7df0a3a5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4033426
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2022-11-17 02:37:47 +00:00
Shintaro Kawamura
df2ec8ec88 Reland "swap: add PageHandler"
origin:
https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3944711

PageHandler handles events from userfaultfd using SwapFile.

tests are placed as integration tests since they rely on userfaultfd(2).

design document: go/tanooki-phase1-dd

BUG=b:215093219
TEST=cargo test -p swap page_handler

Change-Id: I64d213d27174d75ee618c4675ea52dbac58bfe59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4016144
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2022-11-14 06:14:07 +00:00