L2ARC: Implement persistent markers with consistent tail scanning

This commit introduces per-sublist persistent markers that eliminate
redundant tail scanning between L2ARC iterations, providing significant
CPU efficiency improvements. Markers are pre-allocated during device
initialization and properly cleaned up during device removal.

The implementation uses conditional behavior based on device capacity:
small devices (capacity < arc_c) retain original HEAD/TAIL scanning
based on ARC warmup state, while large devices (capacity >= arc_c)
use the persistent marker approach for optimal CPU efficiency.

Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #18093
This commit is contained in:
Ameer Hamza
2025-07-06 03:41:54 +05:00
committed by Brian Behlendorf
parent 3523b5f3f9
commit 2f41b9d865
3 changed files with 307 additions and 39 deletions
+10
View File
@@ -41,6 +41,16 @@
extern "C" {
#endif
/*
* L2ARC state and statistics for persistent marker management.
*/
typedef struct l2arc_info {
arc_buf_hdr_t ***l2arc_markers; /* persistent markers */
uint64_t l2arc_total_writes; /* total writes for reset */
uint64_t l2arc_total_capacity; /* total L2ARC capacity */
uint64_t l2arc_smallest_capacity; /* smallest device capacity */
} l2arc_info_t;
/*
* Note that buffers can be in one of 6 states:
* ARC_anon - anonymous (discussed below)