Repository navigation
flush: Replace sort with sweep through the hash table - #996
Merged
Merged
Conversation
Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
robertbaldyga
force-pushed
the
flush-rework
branch
2 times, most recently
from
November 10, 2026 22:23
7b8c2bd to
fb6ea66
Compare
The flush collected all dirty cache lines of a core into one array up front and sorted it whole, so its memory grew with the amount of dirty data - about 16 bytes per dirty line, ~12 GB for a dirty 3 TB cache with 4 KiB lines - and the flush failed with -OCF_ERR_NO_MEM when that could not be allocated. Sweep the hash table instead: collect the dirty lines of the flushed core (or of all cores) in the collision lists of consecutive hash buckets, up to a portion, sort the portion by core address and clean it, then go on from the next bucket. The portion size is adapted as before, between 4 MiB and 100 MiB of cache lines, which also bounds the buffer. The hash function assigns consecutive core lines consecutive buckets, so a portion containing lines from consecutive buckets is likely to contain several consecutive core line ranges, interleaved by a collision list length (typically a few lines at most), thus the portion needs to be sorted before being passed to the cleaner. To keep more than one portion in flight, the hash table is split into slices swept concurrently, one per core with dirty data, at most 16. A line is in the list of exactly one bucket, so slices never collect the same line. Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
robertbaldyga
force-pushed
the
flush-rework
branch
from
November 10, 2026 22:42
fb6ea66 to
3370c2d
Compare
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.
No description provided.