Repository navigation
Uncompress boot entries outside the heap - #1352
Merged
Merged
Conversation
Each vfasl boot entry was uncompressed into a heap bytevector (DSTBV) that the compaction before the next entry freed. The static image placed around it kept the holes, and no later buffer or image block fit them, so a boot held several chunks of empty segments: a closed-world hello on bionic had 719 free segments (11.8MB) at the end of its boot and peaked at 49.3MB for 33MB live, at the edge of the footprint gate. The boot-load-in-place kernel patch now uncompresses a boot entry into memory from S_getmem, released once the entry is loaded, and vfasl reads the image from there. The same hello peaks at 43.9MB on bionic and 42.0MB on macOS (was 47.4MB with the same patched kernel). A stock kernel is unaffected.
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.
The bionic footprint row kept flipping on unrelated PRs (#1333, #1335, #1336, #1340) because the boot transient sat within one 2MB chunk of the limit. Most of that transient was fragmentation, not data: each vfasl boot entry was uncompressed into a heap bytevector that the compaction before the next entry freed, and the static image placed around it kept the holes. At the end of a closed-world hello's boot on bionic, 719 segments (11.8MB) were empty but held.
The boot-load-in-place kernel patch (0003) now uncompresses a boot entry into S_getmem memory, released once the entry is loaded, and vfasl reads the image from there (S_vfasl_bytes). Runtime fasl reads keep the heap buffers. Folded into 0003 rather than a new patch since it rewrites the same hunks, which would break apply-chez-patches' reverse-check idempotency. A stock kernel (Homebrew, distro) is unchanged.
Closed-world hello from the footprint gate, bionic (tools/termux), 12 runs each, peak / live, limit is peak - live <= live/2:
macOS with the same patch set built locally, old 0003 vs new: 47,382,528 -> 41,975,808 for 33.07MB live (headroom 2.2 -> 7.6MB).
Startup, A/B/A, min/median: bionic closed-world hello 70.7/74.9 -> 72.7/77.4 ms (1.03x), jolt -e nil 141.1/145.9 -> 148.9/155.9 ms (1.05-1.07x); macOS hello 51.0/55.1 -> 52.5/54.9 ms, jolt -e nil 90.1/94.1 -> 91.2/96.6 ms. Keeping one buffer across entries to skip the page faults made no measurable difference to startup and cost up to 0.9MB of peak, so it is not here.
make test passes on macOS with this kernel and with Homebrew's; footprint and closedstdout pass on bionic. Linux CI caches key on the patches' hash, so the kernels rebuild.