L2ARC: Write budget fairness for metadata monopolization

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.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #18289
This commit is contained in:
Ameer Hamza
2026-03-05 19:17:03 +05:00
committed by Brian Behlendorf
parent 62ca8f721b
commit b27a87f399
4 changed files with 50 additions and 0 deletions
+6
View File
@@ -469,6 +469,12 @@ typedef struct l2arc_dev {
boolean_t l2ad_thread_exit; /* signal thread exit */
kmutex_t l2ad_feed_thr_lock; /* thread sleep/wake */
kcondvar_t l2ad_feed_cv; /* thread wakeup cv */
/*
* Consecutive cycles where metadata filled write budget
* while data passes got nothing written. Used to detect
* monopolization and skip metadata to give data a chance.
*/
uint64_t l2ad_meta_cycles;
} l2arc_dev_t;
/*