-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix(vmm): only use memfd if no vhost-user-blk devices configured #4498
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4498 +/- ##
==========================================
- Coverage 81.63% 81.54% -0.10%
==========================================
Files 243 243
Lines 29825 29839 +14
==========================================
- Hits 24349 24333 -16
- Misses 5476 5506 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
5919aba
to
f4e4904
Compare
Page faults are more expensive for shared memory mapping (like memfd). For this reason, we only back guest memory with a memfd if a vhost-user-blk device is configured in the VM, otherwise we fall back to anonymous private memory. This is recovering performance demonstrated before commit 027a992 had been merged. The vhost-user-blk branch in VM creation is not currently covered by Rust integration tests, because we are looking for a converging solution, so guest memory is always created in the same way, and implementing required integration test infrastructure code (spawing a backend process) would not be useful long term. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
This is because guest memory is backed by anon private mapping in a regular case. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
Huge pages tests search for memory mapping name, which is now anon private instead of memfd. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
This brings the former negative file size limit test from before 60737eb , which is valid for anon private guest memory backing. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have some small suggestions
Mention memfd page fault overhead and host pagecache usage for virtio block devices compared to vhost-user. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
Adds a changelog entry that VMs that do not use vhost-user-blk devices are backed by anon private memory mapping. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the changes.
Changes
Only back guest memory with a memfd if a vhost-user-blk device is configured in the VM, otherwise fall back to anonymous private memory.
This is recovering performance demonstrated before commit 027a992 had been merged.
Reason
Page faults are more expensive for shared memory mapping (like memfd).
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
[ ] If a specific issue led to this PR, this PR closes the issue.[ ] Any required documentation changes (code and docs) are included in thisPR.
[ ] API changes follow the Runbook for Firecracker API changes.CHANGELOG.md
.[ ] NewTODO
s link to an issue.contribution quality standards.
rust-vmm
.