diff --git a/module/zfs/arc.c b/module/zfs/arc.c index fa69e1ea4..b18c7a586 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -4414,8 +4414,10 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc) return (SHRINK_STOP); /* Reclaim in progress */ - if (mutex_tryenter(&arc_reclaim_lock) == 0) + if (mutex_tryenter(&arc_reclaim_lock) == 0) { + ARCSTAT_INCR(arcstat_need_free, ptob(sc->nr_to_scan)); return (SHRINK_STOP); + } mutex_exit(&arc_reclaim_lock); @@ -4453,7 +4455,6 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc) ARCSTAT_BUMP(arcstat_memory_indirect_count); } else { arc_no_grow = B_TRUE; - ARCSTAT_INCR(arcstat_need_free, ptob(sc->nr_to_scan)); ARCSTAT_BUMP(arcstat_memory_direct_count); }