]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rcutorture: Add cond_resched() to forward-progress free-up loop
authorPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 9 Apr 2019 17:08:18 +0000 (10:08 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 16:06:09 +0000 (09:06 -0700)
The rcu_torture_fwd_prog_cbfree() function frees callbacks used during
rcutorture's call_rcu() forward-progress test, but does so in a tight
loop.  This could cause problems given a very long list of callbacks to be
freed, and actual testing produces lists with as many as 25M callbacks.
This commit therefore adds a cond_resched() to this loop.  While in
the area, this commit also rearranges the lock releases to look a bit
more sane.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
kernel/rcu/rcutorture.c

index efaa5b3f4d3f0dc2faff7c4d8a1a5a5757ed2ff2..7906ba2d9dad91ee680dc93bdd85fb98a67286cb 100644 (file)
@@ -1674,16 +1674,18 @@ static unsigned long rcu_torture_fwd_prog_cbfree(void)
        for (;;) {
                spin_lock_irqsave(&rcu_fwd_lock, flags);
                rfcp = rcu_fwd_cb_head;
-               if (!rfcp)
+               if (!rfcp) {
+                       spin_unlock_irqrestore(&rcu_fwd_lock, flags);
                        break;
+               }
                rcu_fwd_cb_head = rfcp->rfc_next;
                if (!rcu_fwd_cb_head)
                        rcu_fwd_cb_tail = &rcu_fwd_cb_head;
                spin_unlock_irqrestore(&rcu_fwd_lock, flags);
                kfree(rfcp);
                freed++;
+               cond_resched();
        }
-       spin_unlock_irqrestore(&rcu_fwd_lock, flags);
        return freed;
 }