Repository navigation
Conversation
Contributor
Author
|
@yihong0618 yes it was still possible to get into the state mentioned; this refactor should make it recoverable in a safe way |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
mjc
force-pushed
the
mjc/lru-overflow-recovery
branch
from
June 16, 2026 04:33
b144ca7 to
5405515
Compare
Avoid panicking when LRU high-priority weight accounting drifts from the intrusive high-priority list. Replace the empty-list overflow unwrap with recovery that recalculates the tracked weight from the actual list. Route high-priority weight decrements through a checked helper so overflow, pop, remove, and acquire paths repair stale accounting instead of underflowing or preserving poisoned state. Add regression coverage for empty-list overcount, understated counters, and last-entry overflow recovery. Signed-off-by: Mika Cohen <mjc@kernel.org>
mjc
force-pushed
the
mjc/lru-overflow-recovery
branch
from
June 19, 2026 15:31
5405515 to
73d40aa
Compare
This branch has not been deployed
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.
What's changed and what's your intention?
Fix LRU high-priority weight recovery when the tracked counter drifts from the intrusive high-priority list.
The overflow path assumed
high_priority_weight > high_priority_weight_capacityalways implied a non-empty high-priority list, and could panic if the accounting was already stale. This PR repairs stale accounting by recomputing the actual high-priority list weight when recovery is needed, and routes high-priority decrements through a checked helper used by overflow, pop, remove, and acquire paths.A user of a crate I maintain ran into this scenario in nntp-proxy#73.
Checklist
cargo x(orcargo x --fastinstead if the old tests are not modified) in my local environment.cargo x --fastwas run; clippy, strict test run, doctests, docs, examples, andcargo-machetepassed, then the final legacylicense-eye header checkstep failed. The current license workflow command,hawkeye check, passes.