Fix undetected pinned element in advance_hot #96
Closed
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.
In
advance_hot, if an element is concurrently marked as pinned right after theis_pinnedfunction return false (line 738), the function will loop forever if every element is pinned as unpinned cannot decrement, i.e. the function doesn't detect that the element was pinned in the meantime.This can happen if the element pinning logic is independent of the cache data structure.
This PR fixes this by storing which key is marked as unpinned, and clearing it if it gets pinned in the meantime.