Repository navigation
fix(memory): resample unthrottled after allocator trim - #2859
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
6 of 8 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.
Summary
masterthe trim callback still callssample_for_checkpoint().Motivation
The pressure latch only clears once memory drops below the low watermark. Suppose an indexing checkpoint sampled within the last
RESIDENT_MEMORY_CHECKPOINT_SAMPLE_INTERVAL_V1. The post-trim call then returns the standing state without reading memory again.run_pressure_reclaimersdoesn't resample afterwards either, so the latch stays OverBudget even though memory has recovered. Admissions keep being refused until the maintenance sampler next runs.Changes
crates/tracedecay-runtime-core/src/resident_memory.rs: adds a privateresample_after_reclaimand calls it from the allocator trim reclaimer. It publishes the cgroup-aware admission bytes and the gauge. It does not callrun_pressure_reclaimers, so the reclaimers can't re-enter.crates/tracedecay-runtime-core/src/resident_memory/tests.rs: addsallocator_trim_readmits_growth_when_memory_recovers_inside_checkpoint_throttle. The test checks the behavior throughProcessResidentMemoryV1::reserve, the API admission callers actually use, with literal inputs:reserveis refused withObservedOverBudget.reservenow succeeds, and the ledger records 16 MiB used.Test plan
cargo nextest run --workspace --no-fail-fastpasses (left to CI)cargo clippy -p tracedecay-runtime-core --all-targets -- -D warningscleancargo test -p tracedecay-runtime-core --lib resident_memory: 52 passed. With the oldsample_for_checkpoint()call restored, the new test fails at the post-recoveryreserve, which is still refused.cargo fmt --all -- --checkChecklist
CHANGELOG.mdupdated (under[Unreleased]if no version bump).envfiles includedLink to Devin session: https://app.devin.ai/sessions/9f41edacea9a4fffb64bd90be9914a12
Open in Devin Desktop: https://app.devin.ai/desktop/session/9f41edacea9a4fffb64bd90be9914a12?variant=devin
Requested by: @ScriptedAlchemy
Local verification (land-open-prs)
On the head rebased onto master 9d24792:
pressure.sample_for_checkpoint(),resident_memory::tests::allocator_trim_readmits_growth_when_memory_recovers_inside_checkpoint_throttlefails 10/10 (tests.rs:1202, growth refused).cargo test -p tracedecay-runtime-core --lib -- resident_memory --test-threads=16: 52 passed.cargo test -p tracedecay-cli --features alloc-mimalloc --test refresh_memory_journey(shipped daemon cold-indexing and refreshing a 300-file heavy corpus under a 6 GiB limit): 2 passed in 149 s.cargo clippy -p tracedecay-runtime-core --all-targets -- -D warningsclean;cargo fmt --all -- --checkclean. No cfg-gated code touched.This carries the remaining part of #2596 (closed); #2851 landed its first two commits.