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 GitHub
parent 7822b50f54
commit dc56c673e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4469,7 +4469,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 {