Unified transient allocator candidate
This candidate replaces both general/upper Arena backends and the codec
allocator with one extent/slot engine. It is based on 296f6309; rejected
f1244b00 is an independent historical experiment, not a dependency or fallback.
Parent integration owns the canonical kernel/design-document reconciliation.
The current grouped follow-up carries a claimed row directly into its final allocation state instead of publishing/reloading it. Fresh slabs publish their first live slot once, avoiding available-list insertion/removal for one-slot extents. The maintained empty free-bin bitmap skips unnecessary class/probe work, and codec allocation no longer checks the same frontier twice. The final grouped allocator changes passed one native invariant batch; combined application, lifecycle and full-workload qualification remains pending.
Each physical extent has one 32-byte external row: start/length, physical previous/next, exclusive free-bin or available-slab links, and small-slot free/bump/live/class/flags. An eight-byte small-slot prefix contains the same four-byte row-offset owner tag used by large/overaligned allocations. Free slots store a two-byte next index in reusable payload storage. There are no backing allocation headers, duplicate extent/slot ownership tables, or old-allocator fallbacks. Free and realloc follow the true row owner regardless of codec scope.
The unchanged runtime base is 2 MiB. The first 32 KiB remains the preferred codec domain, served by this same engine. The next 4 KiB holds 128 descriptor cells (three reserved for domain roots). General payload starts immediately after this prefix, and excludes the existing bootstrap gap. Overflow descriptor banks are carved only from free physical tails; they remain reserved until quiescent startup. Prefix and overflow spare-row heads prefer nearby retired rows after bursts, without scanning or relocating live allocations. This is a finite locality preference, not a guarantee that arbitrary live populations fit the first IC region.
Only requested payloads at most 128 bytes with alignment at most eight use slots:
16 exact classes have strides 16 through 136. Larger/overaligned requests use the
same dense extent engine; there is no secondary allocator or role/type registry.
This keeps the fixture's 192/288-byte BTreeMap<u64,u64> node shapes out of
separate class slabs. Medium objects have no class rounding or per-slab tail
waste, at the cost of one 32-byte external descriptor per allocation. Whether
this improves actual read-path page sets requires the combined benchmark.
The first tiny extent per class is max(128, stride) bytes and stays empty for
later small calls. The nominal warm payload bound is 2,056 bytes, plus less than MIN_SPLIT possible
extent-tail slack per class. Refills grow geometrically from this first size as
the number of active slabs in that class grows, capped at 4096 bytes.
A four-byte per-class count changes only on slab creation/reclamation; it is
checked against the physical rows in native tests. After drain, sparse classes
refill compactly again. Refills are released/coalesced as soon as their last slot
dies. Allocation pressure may trim empty starter
extents. All extents are eight-byte aligned; these nominal sizes
do not imply absolute 4 KiB/64 KiB containment. Only the fixed initial prefix's
absolute placement is known in advance.
Large/overaligned allocations share the same physical rows, free index and coalescing path. The request's rounded size bin checks at most four candidates, then uses a larger bin or a free frontier. A fitting extent deeper in that one bin can be deferred: this is an explicit bounded-search fragmentation tradeoff. Exact-fit requests need no additional descriptor. Growing metadata reselects a candidate after tail shrink. Failed realloc preserves the old bytes and owner; there is no message, scope or await reset. GlobalAlloc's existing zeroed path still clears the requested bytes; fresh metadata initializes only claimed rows.
Native qualification uses the pinned compiler and exclusive warm target:
export CARGO_TARGET_DIR=/srv/shared/code/icrustmem/rrt/tmp/perf-round2/targets/contract-pair
source /srv/shared/code/icrustmem/ver1/tools/env.sh
cargo metadata --manifest-path ver1/Cargo.toml --offline --locked --format-version 1 > /dev/null
cargo test --manifest-path ver1/Cargo.toml -p cdk-rsx-platform --offline --locked --lib
cargo test --manifest-path ver1/Cargo.toml -p cdk-rsx-platform --offline --locked --lib --features page-profile
For the final grouped allocator: default 18/18, page-profile 19/19, locked offline metadata and
git diff --check pass. Tests cover all small sizes, alignment through 4096,
origin-independent realloc/failure, bootstrap exclusion, sparse 900 MiB capacity,
randomized payload-preserving churn, physical/list/slot consistency, metadata
overflow and reuse, six-MiB contiguous allocation after burst/drain, exact-fit
descriptor exhaustion, and post-burst cheap allocation address geometry. The
medium-layout test checks exact dense extents across 129..16384 bytes while
preserving live 1/4 KiB buffers. The repeated tiny-buffer burst test pins a live
15 KiB buffer, checks refill growth/ceiling and following allocation geometry, verifies all live bytes,
and confirms compact refill recovery after each of three drains.
Native address checks are not measured IC page-fee results.
Raw native logs and exact source/compiler receipt are in the shared ignored
output directories rrt/tmp/perf-round9/runtime-unified/native/ (first candidate)
and native-compact/ (compact first-extent correction).
The adaptive refill logs/receipt are in native-adaptive/.
The final grouped native logs/receipt are in native-grouped/.
The first candidate 67ea4204 passed native 16/16 and profile 17/17 but failed the
populated SDK gate: retained +7.70%, stable +9.17% instructions. Its three-call
native trace found only region 33 added to both accessed and dirty sets, exactly
160,000 extra page instructions per call; region 255 was absent. Thus fixing the
old cold descriptor bank alone was insufficient. These receipts remain at
rrt/tmp/perf-round9/unified-screen/cheap/ and native-trace/. The compact
first-extent policy above follows this negative evidence; it changes no live
ownership or lifetime rules.
The compact candidate 8eee1667 reduced the cheap SDK aggregate to retained
+2.71% and stable +0.93%, but retained preview still added region 33 and 160,000
page instructions. Stable transfer/preview page sets matched control. A separate
diagnostic build captured 116 allocator events without overflow: a 1600-byte
request used a 16 KiB bulk slab, and a 64-byte request used the following 4 KiB
slab with its pointer directly in region 33. Recorder-off page sets matched the
ordinary candidate; recording added only private scratch traffic. These facts
motivate the bounded adaptive refills, without moving or reclaiming live slabs.
Diagnostic artifacts and the earlier corrupted instrumentation preflight stay
separate from ordinary measurements.
The next gate is the user's combined source batch, including full SDK heap and durable workloads, actual async/trap/KEEP and Heavy16. No separate per-edit SDK run is planned; no performance gain or production acceptance is claimed here.
The completed 1e951988 full SDK screen passed behavior and source guards but
still regressed heap overall by 10.847% (100k distributed transfer/checkout/
preview +17.06/+11.07/+13.58%). Retained and stable overall changed +0.354% and
+0.820%; upstream was exact. The native three-call durable replay confirmed
baseline accessed/dirty sets, including retained preview. The allocator is not
accepted on this evidence. Full results remain in
rrt/tmp/perf-round9/unified-screen/adaptive-full/. The grouped follow-up removes
unnecessary computation and medium-size class segregation; it is not a claim
that these placement costs are solved before the combined gate.