kvfree_rcu: Use kfree_rcu_monitor() instead of open-coded variant
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Thu, 15 Apr 2021 17:20:00 +0000 (19:20 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 10 May 2021 23:00:48 +0000 (16:00 -0700)
Replace an open-coded version of the kfree_rcu_monitor() function body
with a call to that function.

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

index 1ae5f88e475f0fc580a5264677c0e378b9607e4c..d643fd8327b618381cbffd0b6532ea256dbd099f 100644 (file)
@@ -3697,7 +3697,6 @@ static unsigned long
 kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 {
        int cpu, freed = 0;
-       unsigned long flags;
 
        for_each_possible_cpu(cpu) {
                int count;
@@ -3705,12 +3704,7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 
                count = krcp->count;
                count += drain_page_cache(krcp);
-
-               raw_spin_lock_irqsave(&krcp->lock, flags);
-               if (krcp->monitor_todo)
-                       kfree_rcu_drain_unlock(krcp, flags);
-               else
-                       raw_spin_unlock_irqrestore(&krcp->lock, flags);
+               kfree_rcu_monitor(&krcp->monitor_work.work);
 
                sc->nr_to_scan -= count;
                freed += count;