Skip to content

Commit

Permalink
rcu: Avoid redundant grace-period kthread wakeups
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
  • Loading branch information
Paul E. McKenney committed Aug 19, 2013
1 parent ae15018 commit 1eafd31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel/rcutree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,10 +1576,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);
}

/*
Expand Down

0 comments on commit 1eafd31

Please sign in to comment.