L2ARC: Add depth cap and write budget fairness for persistent markers#18289
Open
ixhamza wants to merge 5 commits intoopenzfs:masterfrom
Open
L2ARC: Add depth cap and write budget fairness for persistent markers#18289ixhamza wants to merge 5 commits intoopenzfs:masterfrom
ixhamza wants to merge 5 commits intoopenzfs:masterfrom
Conversation
The dynamic headroom redistribution formula gave later sublists progressively larger scanning budgets, and random sublist selection caused uneven coverage across sublists. For depth cap to work effectively, each sublist should be equally and fairly treated. Use equal per-sublist headroom (headroom / num_sublists) for even distribution and deterministic round-robin selection for fair coverage across cycles. Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Replace direct marker-to-tail manipulation with per-sublist boolean flags consumed lazily by feed threads. Each scanning thread resets its own marker when it sees the flag, rather than having another thread manipulate the marker directly. Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
With persistent markers and inclusive scanning, the marker traverses the entire ARC state across many feed cycles, writing buffers far from the tail that may no longer be relevant. Track cumulative bytes scanned per pass in l2arc_ext_scanned. When scans reach l2arc_ext_headroom_pct (default 25%) of the ARC state size, reset the pass markers to the tail via lazy reset flags. This keeps markers focused on the tail zone where recently evicted buffers have the most value for L2ARC. Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Under heavy metadata load, metadata passes can monopolize the write budget every cycle while data passes get nothing written. Track consecutive monopolized cycles per device in l2ad_meta_cycles. After l2arc_meta_cycles (default 2) consecutive cycles where metadata fills the write budget, skip metadata for one cycle to let data run. Reset the counter when nothing is written. Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
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.
Motivation and Context
Follow-up to #18093. With persistent markers, scan positions drift indefinitely toward the head of ARC eviction lists where buffers will stay in ARC for a while, writing them to L2ARC adds little value since ARC already serves them. The tail is where buffers are closest to eviction and benefit most from L2ARC. Additionally, when eviction outpaces L2ARC write throughput, metadata passes run first and can fill the entire write budget every cycle, starving data passes of buffers that could have produced L2ARC hits.
Description
l2arc_ext_headroom_pct(default 25%) of ARC state size. Keeps markers in the tail zone where L2ARC adds the most value. Set to 0 to disable.How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by.