feat: CoW fork stacks, demand-paged stack growth, blocking pipe reads#185
Merged
feat: CoW fork stacks, demand-paged stack growth, blocking pipe reads#185
Conversation
Replace fork's redundant stack allocation/copy with CoW sharing — the parent's stack pages are already CoW-mapped by setup_cow_pages(), so the child can reuse them directly. This makes fork significantly faster and removes the CHILD_STACK_SIZE hack entirely. Add demand-paged stack growth: when userspace touches memory just below the current stack bottom, the page fault handler allocates and maps new pages on demand (up to 2MB MAX_USER_STACK_SIZE), eliminating the need to pre-allocate large stacks. The faster CoW fork exposed a latent race condition where parents would read from pipes before children had written, getting EAGAIN. Implement proper blocking pipe reads following the existing FIFO blocking pattern (register waiter, block thread, HLT loop, retry on wake). Also: suppress ELF loader debug logging (→ trace level) that was flooding serial output, fix test binary paths to match ext2 layout, rebuild ext2 image with all userspace binaries, fix exec_from_ext2_test expected exit code to match hello_std_real. All 252 boot stages pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ARM64 CI branch had temporarily removed x86_64 testing from boot-tests.yml. Add back the x86_64 boot-stages (252 tests) and kthread-stress jobs so both architectures are tested on every PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
setup_cow_pages(), so children reuse them directly. EliminatesCHILD_STACK_SIZEhack entirely.MAX_USER_STACK_SIZE) when userspace touches memory below the current stack bottom.Test plan
cargo build --releasewith zero warnings🤖 Generated with Claude Code