plan: print every placement term, and a switch to A/B the slab shrink (#885) - #899
Merged
Conversation
…#885) #885's follow-up says #869 was half a fix, and the measurement that established that took fourteen instrumented runs on a 128 GB host to recover numbers this engine already had in registers. g64 cap raised 8->31 (v1.4.0: 31, v1.5.0: 17) the width fix landed E8 cap raised 8->45 (v1.4.0: 46, v1.5.0: 17) g64 RSS 105.8 -> 64.1 -> 84.67 GB and stopped there E8 RSS 106.5 -> 47.5 -> 75.6 GB THE LINE ONLY PRINTED WHEN THE CLAMP BIT if(pin_bytes+1.0<planned_pin) fprintf(stderr,"[PIN] auto: %.1f GB plan capped to %.1f GB ...") So "the reserve was zero" and "the reserve did not bind" were indistinguishable from outside -- and those are the two hypotheses anyone debugging placement is choosing between. @mohamedmastouri2000-boop asked for exactly this, twice, before anyone acted on it. It now prints every term, every time: [PIN] auto: budget X GB | plan Y GB (conf C, N selections) | LRU reserve Z GB (cap K/layer x W MB/row-set) | max_pin M GB -> pinning P GB [CAPPED by the LRU reserve] budget is what expert_avail() left; plan is 0.5*budget*confidence; reserve is what #815 holds back for the demand-filled LRU; max_pin is budget minus reserve. A reserve near the budget means the pin is starved by a reservation the LRU may never claim, which is the open half of #885 and is now visible at a glance instead of by inference. COLI_SLAB_SHRINK=0 #869 introduced the only new allocator work in that change and said the cost was unmeasured. #885 then measured it, on the arm that has it: v1.4.0 g64 1.21, 1.23 spread 0.02 v1.5.0 g64 1.00, 1.01 spread 0.01 dev E8 1.43, 1.43 spread 0.00 dev g64 1.12 .98 1.11 .97 1.05 spread 0.15, bimodal Every arm on that box replicates to <=0.02 except the one that is new. Reallocating 19-38 MB per crossed row is an mmap/munmap plus page faults on first touch, which is a per-run effect, which is what bimodal looks like. The switch restores grow-only so the hypothesis can be A/B'd without a rebuild. It re-introduces the slab migration, so the per-row cap becomes optimistic again -- a diagnostic, not a supported configuration, and it says so on stderr when set. A DUPLICATE SYMBOL, FROM A MERGE OF MINE 91: static int g_metal_enabled; (#587, unconditional, with a comment explaining why it must be outside) 100: static int g_metal_enabled; (the original, still inside #ifdef) Two tentative definitions the linker merges, so no warning, no symptom, and green CI. I verified #587's colibri.c changes were all gated behind g_metal_enabled -- which was true -- and did not check whether the symbol was already there. Removed; the unconditional one stays. TESTS test_cap_mixed_width gains case E, which exercises the switch by setting g_slab_shrink directly. It has to: the variable is read from the environment in main(), which the test does not run, so exporting COLI_SLAB_SHRINK would have proved nothing -- and on the first attempt it did exactly that, passing identically with the switch on and off. E. shrink OFF: 892928 B -> 892928 B (must not move) E. shrink ON : 892928 B -> 450560 B (must come down) make check: 388 tests, 0 failures. Refs #885, #869, #815, #587 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5 tasks
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.
@mohamedmastouri2000-boop's follow-up on #885 says #869 was half a fix. The measurement that established that took fourteen instrumented runs on a 128 GB host to recover numbers this engine already had in registers.
This PR does not attempt the remaining fix. It makes the remaining fix decidable.
The line only printed when the clamp bit
So "the reserve was zero" and "the reserve did not bind" were indistinguishable from outside — and those are the two hypotheses anyone debugging placement is choosing between. It now prints every term, every time:
A reserve near the budget means the pin is starved by a reservation the LRU may never claim — it is demand-filled and only allocates on a miss. That is the open half of #885, and it is now visible at a glance instead of by inference.
@mohamedmastouri2000-boop asked for exactly this, twice, before anyone acted on it. That is the actual lesson here.
COLI_SLAB_SHRINK=0#869 introduced the only new allocator work in that change and stated the cost was unmeasured. #885 then measured it, on the arm that has it:
Every arm on that box replicates to ≤0.02 except the one that is new. Reallocating 19–38 MB per crossed row is an
mmap/munmapplus page faults on first touch — a per-run effect, which is what bimodal looks like.The switch restores grow-only so the hypothesis can be A/B'd without a rebuild. It re-introduces the slab migration, so the per-row cap becomes optimistic again: a diagnostic, not a supported configuration, and it says so on stderr when set.
A duplicate symbol, from a merge of mine
Two tentative definitions the linker merges — no warning, no symptom, green CI. I verified #587's
colibri.cchanges were all gated behindg_metal_enabled, which was true, and did not check whether the symbol was already there. Removed; the unconditional one stays.Tests
test_cap_mixed_widthgains case E, which exercises the switch by settingg_slab_shrinkdirectly. It has to: the variable is read from the environment inmain(), which the test does not run — so exportingCOLI_SLAB_SHRINKwould have proved nothing, and on the first attempt it did exactly that, passing identically with the switch on and off.make check: 388 tests, 0 failures.Refs #885, #869, #815, #587
🤖 Generated with Claude Code