diff options
author | shodanshok <[email protected]> | 2022-11-11 19:41:36 +0100 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-12-01 12:39:43 -0800 |
commit | d9de079a4b9cde7b1a958512ce8948a57324c518 (patch) | |
tree | 738d4b12283f9acb020aa0d2e80db0080f49ac46 /module | |
parent | 957c3776f2ac211afaba0bb89f2592b6410a7a17 (diff) |
Fix arc_p aggressive increase
The original ARC paper called for an initial 50/50 MRU/MFU split
and this is accounted in various places where arc_p = arc_c >> 1,
with further adjustment based on ghost lists size/hit. However, in
current code both arc_adapt() and arc_get_data_impl() aggressively
grow arc_p until arc_c is reached, causing unneeded pressure on
MFU and greatly reducing its scan-resistance until ghost list
adjustments kick in.
This patch restores the original behavior of initially having arc_p
as 1/2 of total ARC, without preventing MRU to use up to 100% total
ARC when MFU is empty.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Gionatan Danti <[email protected]>
Closes #14137
Closes #14120
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/arc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 8bf5ce09a..fe66fd83d 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -5166,7 +5166,7 @@ arc_adapt(int bytes, arc_state_t *state) atomic_add_64(&arc_c, (int64_t)bytes); if (arc_c > arc_c_max) arc_c = arc_c_max; - else if (state == arc_anon) + else if (state == arc_anon && arc_p < arc_c >> 1) atomic_add_64(&arc_p, (int64_t)bytes); if (arc_p > arc_c) arc_p = arc_c; @@ -5379,7 +5379,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, void *tag, if (aggsum_upper_bound(&arc_sums.arcstat_size) < arc_c && hdr->b_l1hdr.b_state == arc_anon && (zfs_refcount_count(&arc_anon->arcs_size) + - zfs_refcount_count(&arc_mru->arcs_size) > arc_p)) + zfs_refcount_count(&arc_mru->arcs_size) > arc_p && + arc_p < arc_c >> 1)) arc_p = MIN(arc_c, arc_p + size); } } |