rcu: Stop shrinker loop
authorPeter Enderborg <peter.enderborg@sony.com>
Thu, 4 Jun 2020 10:23:20 +0000 (12:23 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 29 Jun 2020 18:58:51 +0000 (11:58 -0700)
The count and scan can be separated in time, and there is a fair chance
that all work is already done when the scan starts, which might in turn
result in a needless retry.  This commit therefore avoids this retry by
returning SHRINK_STOP.

Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Peter Enderborg <peter.enderborg@sony.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree.c

index d17e5a08bf43f5442112c963dad18b34041771a8..c8196fab563c2487c90fc5d23ac27010a1d35408 100644 (file)
@@ -3332,7 +3332,7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
                        break;
        }
 
-       return freed;
+       return freed == 0 ? SHRINK_STOP : freed;
 }
 
 static struct shrinker kfree_rcu_shrinker = {