Fix ARC target collapse when zfs_arc_meta_limit_percent=100

Reclaim metadata when arc_available_memory < 0 even if
meta_used is not bigger than arc_meta_limit.

As described in https://github.com/openzfs/zfs/issues/14054 if
zfs_arc_meta_limit_percent=100 then ARC target can collapse to
arc_min due to arc_purge not freeing any metadata.

This patch lets arc_prune to do its work when arc_available_memory
is negative even if meta_used is not bigger than arc_meta_limit,
avoiding ARC target collapse.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Gionatan Danti <g.danti@assyoma.it>
Closes #14054 
Closes #14093
This commit is contained in:
shodanshok 2022-10-28 19:21:54 +02:00 committed by Brian Behlendorf
parent 8929355b4c
commit 1d2b0563f7
1 changed files with 1 additions and 1 deletions

View File

@ -4460,7 +4460,7 @@ restart:
* meta buffers. Requests to the upper layers will be made with * meta buffers. Requests to the upper layers will be made with
* increasingly large scan sizes until the ARC is below the limit. * increasingly large scan sizes until the ARC is below the limit.
*/ */
if (meta_used > arc_meta_limit) { if (meta_used > arc_meta_limit || arc_available_memory() < 0) {
if (type == ARC_BUFC_DATA) { if (type == ARC_BUFC_DATA) {
type = ARC_BUFC_METADATA; type = ARC_BUFC_METADATA;
} else { } else {