Dirty pages deduplication between diff and base layer for memory#2590
Dirty pages deduplication between diff and base layer for memory#2590
Conversation
We are making a larger change to enable memfd-backed guest memory in Firecracker. When enabled, Firecracker passes over the memfd file descriptor over the UFFD UDS, alongside the UFFD file descriptor. Parse this and create a Memfd object, which we can later use to interact with the sandbox memory. Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Currently, orchestrator calls process_vm_readv() system call to copy memory from Firecracker process into the cache backing file. Add logic to use read directly from memfd, when that is present. Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Add a feature flag that controls whether the orchestrator will instruct Firecracker to use memfd for backing the guest memory. Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
PR SummaryHigh Risk Overview Reviewed by Cursor Bugbot for commit 2b6ebdd. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 7 Tests Failed:
View the full list of 7 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Code Review
This pull request implements memfd-backed guest memory support for Firecracker, enabling the orchestrator to retrieve dirty pages via pread on a shared file descriptor instead of process_vm_readv. Key changes include a new 4KiB page deduplication routine in the block cache, updates to the UFFD handler to manage the received memfd, and integration into the sandbox lifecycle via a new feature flag. I have no feedback to provide as the implementation is robust and no issues were identified.
WIP