Skip to content

Commit 1abbc0d

Browse files
committed
fixed aggressive arc_p increase
Fixes #14120 The original ARC paper calls for an initial 50/50 split between MRU and MFU caches, and this is included in current code via some arc_p = arc_c >> 1 assignement. However, both arc_adapt() and arc_get_data_impl() are too aggressive in letting arc_p == arc_c, with the result that MFU cache can be totally evicted by MRU cache until the ghost list adapt code kick in. This patch restores the original arc_p = arc_c >> 1 intent, without preventing MRU to be 100% of actual ARC if MFU is empty. Signed-off-by: Gionatan Danti <[email protected]>
1 parent a96e092 commit 1abbc0d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

module/zfs/arc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,7 +5173,7 @@ arc_adapt(int bytes, arc_state_t *state)
51735173
atomic_add_64(&arc_c, (int64_t)bytes);
51745174
if (arc_c > arc_c_max)
51755175
arc_c = arc_c_max;
5176-
else if (state == arc_anon)
5176+
else if (state == arc_anon && arc_p < arc_c >> 1)
51775177
atomic_add_64(&arc_p, (int64_t)bytes);
51785178
if (arc_p > arc_c)
51795179
arc_p = arc_c;
@@ -5386,7 +5386,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, const void *tag,
53865386
if (aggsum_upper_bound(&arc_sums.arcstat_size) < arc_c &&
53875387
hdr->b_l1hdr.b_state == arc_anon &&
53885388
(zfs_refcount_count(&arc_anon->arcs_size) +
5389-
zfs_refcount_count(&arc_mru->arcs_size) > arc_p))
5389+
zfs_refcount_count(&arc_mru->arcs_size) > arc_p &&
5390+
arc_p < arc_c >> 1))
53905391
arc_p = MIN(arc_c, arc_p + size);
53915392
}
53925393
}

0 commit comments

Comments
 (0)