]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Avoid redundant grace-period kthread wakeups
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 20 Jun 2013 20:50:40 +0000 (13:50 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 15 Jul 2013 23:58:33 +0000 (16:58 -0700)
When setting up an in-the-future "advanced" grace period, the code needs
to wake up the relevant grace-period kthread, which it currently does
unconditionally.  However, this results in needless wakeups in the case
where the advanced grace period is being set up by the grace-period
kthread itself, which is a non-uncommon situation.  This commit therefore
checks to see if the running thread is the grace-period kthread, and
avoids doing the irq_work_queue()-mediated wakeup in that case.

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

index 45a86648c650b6d7366bbcd65b252a017a378f08..e84bc1d42e6e2581bfbc7090e7a8f28490bb3b03 100644 (file)
@@ -1516,10 +1516,12 @@ rcu_start_gp_advanced(struct rcu_state *rsp, struct rcu_node *rnp,
 
        /*
         * We can't do wakeups while holding the rnp->lock, as that
-        * could cause possible deadlocks with the rq->lock. Deter
-        * the wakeup to interrupt context.
+        * could cause possible deadlocks with the rq->lock. Defer
+        * the wakeup to interrupt context.  And don't bother waking
+        * up the running kthread.
         */
-       irq_work_queue(&rsp->wakeup_work);
+       if (current != rsp->gp_kthread)
+               irq_work_queue(&rsp->wakeup_work);
 }
 
 /*