pgalloc: skip host holes during checkpoint - #14430
Open
shayonj wants to merge 1 commit into
Open
Conversation
shayonj
force-pushed
the
shayon/checkpoint-extent-discovery
branch
from
August 26, 2026 15:46
1a8b555 to
65578c2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was looking into optimizing checkpoint and restore performance. In doing so, I found that a fair amount of checkpoint CPU was spent in
MemoryFile.SaveTo, where it reads every possibly committed page to find zeroes even when the sparse host backing file already proves that a range reads as zero. Runtime heaps can leave large holes after startup or garbage collection, so this scan can become a material part of checkpoint time.I tried using
SEEK_DATAandSEEK_HOLEto skip those known host holes. The extent path runs only whenfstatproves that more than one eighth of the accounted memory is unbacked, and it still byte-scans every reported data extent. This adds extent queries to qualifying sparse checkpoints, while dense files, disk-backed memory, and hosts where extent discovery fails keep the existing page scan. I left the image format and restore path unchanged, and the change adds no option or application hot-path work.In the end-to-end test I did with a Hono application on Bun 1.4 and a Spring Boot application on OpenJDK 21, each application warmed its router, JSON serialization, and small state map with 2,000 validated requests before checkpoint. The applications used no synthetic heap allocation and validated another request after restore. Hono used HTTP over a Unix socket, while Spring used
MockMvcbecause the direct-containerd harness has no network device. I ran 20 alternating pairs per application.Restore timing, image size, memory use, and faults varied between launches without a consistent candidate effect. Dense or retained heaps continue to use the existing scan.