Repository navigation
beamrt: reuse TCP iolist flatten scratch and close #468 P3 items - #471
Merged
Merged
Conversation
CommaBot
force-pushed
the
feat/wave3d38-beamrt
branch
from
December 6, 2026 01:22
13930b8 to
bef0c97
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.
Summary
Strictly scoped to
crates/beamrt/src/**(Wave 3D-38, based onmain @ 78aaffef):TCP large-iolist send scratch reuse (
crates/beamrt/src/net/prim_inet.rs)Driver::command_with_proc(), when a batched TCP send exceedsIodata::borrow's inlineVECTOR_COUNT/PACKED_BYTES(such asnetbenchraft_log'sflink_sender_loopbatching up to 64AElines per:gen_tcp.send), the fallback previously allocated and freed a freshVec<u8>on every send (3.60%Self-CPU in glibcmalloc/freeunder 0-LOSTperf).SendScratch(TCP_SEND_VEC, capped at64 KiBon drop so oversized payloads are dropped rather than pinned in TLS; alternating oversized/small sends simply fall back to normal allocation, matching the uncached baseline), plus unit testtcp_send_scratch_reuses_and_caps_oversized_buffers.Close all 4 Fable perf(beamrt): Wave 3D-36 selective-receive thunk fast path & #462 P2/P3 closure #468 P3 follow-up items
crates/beamrt/src/mailbox.rs): ClarifiedMsgQueue::examineddoc comment (incremented by RustMsgQueue::peek, omitted by naked-asmbeamrt_recv_peek_thunk).crates/beamrt/src/asm_ctx.rs): Added 3 targeted unit tests pinning (a)recv_peek_thunkfused 64-bit store observed by RustMsgQueue::advance(), (b)recv_next_thunkpriority lane (peeked == 2→cur_prio), and (c)pending_exitdeferral in both branches (non-empty queue stays on fast path; empty queue enters slow path →die_now→Y_EXIT).crates/beamrt/src/scheduler.rs): Movedentries_beforesnapshot afterrt.oversub.spin_backoff_until_ns.swap(...)inoversub_backoff_compacts_short_local_backlog_and_recovers_after_expiry.crates/beamrt/src/asm_ctx.rs): Fixed stale doc comment (r15/x28holdsProcess, not the first argument register).Profiling & R2 Review Notes (
pvg-office-1, Ryzen 7 PRO 8845HS,workers=4)perf&perf statonnetbench/raft_log(beamcvs OTP 29.1.2beam):SendScratchcutraft_loguser CPU by -20.6% (3.29s → 2.61s, 19% lower than OTP 29.1.2 BEAM's3.23s).scheduler.rsenqueue()!localwakeup change in full to preserve thescheduler.rs:229-232invariant (urgent and off-scheduler enqueues are never deferred) and avoid tail-latency risk on mixed CPU/NIF workloads.SEND_SCRATCH_MAX_CAP(64 KiB) drop-on-oversized behavior explicitly onprim_inet.rs.raft_loggap vs BEAM (58.6%of context switches inbeamrt-io-{0..3}) is deferred to Wave 3D-39 for a clean first-principles scheduler-integrated I/O polling design.raft_log_opt,BEAMRT_SCHEDULERS=4):0.00%(< 1%PASS).Verification
./scripts/check-aeneas-subset.sh— PASS./scripts/check-beamrt-ssot.sh— PASScargo clippy -p beamrt --all-targets -- -D warnings— PASS (0 warnings, re-verified on R2)cargo test -p beamrt --lib— PASS (including all 4 new unit tests, re-verified on R2)cargo test -p beamrt --test runtime_tests -- --test-threads=1— PASS (64/64)cargo test -p beamrt --test ssot_matrix_tests— PASS (6/6)