diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 2c7abe6ec542..1a278c795ff3 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -2607,7 +2607,7 @@ arc_evictable_memory(void) { static int __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc) { - uint64_t pages; + uint64_t oldpages, pages; /* The arc is considered warm once reclaim has occurred */ if (unlikely(arc_warm == B_FALSE)) @@ -2632,8 +2632,13 @@ __arc_shrinker_func(struct shrinker *shrink, struct shrink_control *sc) * reap whatever we can from the various arc slabs. */ if (pages > 0) { + oldpages = btop(arc_evictable_memory()); arc_kmem_reap_now(ARC_RECLAIM_AGGR, ptob(sc->nr_to_scan)); pages = btop(arc_evictable_memory()); + if (pages > oldpages) + pages = pages - oldpages; + else + pages = 0; } else { arc_kmem_reap_now(ARC_RECLAIM_CONS, ptob(sc->nr_to_scan)); pages = -1;