rcu/nocb: Avoid needless wakeups of no-CBs grace-period kthread
authorPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 12:54:26 +0000 (05:54 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 13 Aug 2019 21:35:49 +0000 (14:35 -0700)
commit7f36ef82e5cf0b401c2676fb3e56ad0633ed6ad5
tree4c71dcb767da7b42feae5f1d159d2a604d829d03
parentce0a825e40606d6dbe6dfe90d4d4c0ccc9fa3bde
rcu/nocb: Avoid needless wakeups of no-CBs grace-period kthread

Currently, the code provides an extra wakeup for the no-CBs grace-period
kthread if one of its CPUs is generating excessive numbers of callbacks.
But satisfying though it is to wake something up when things are going
south, unless the thing being awakened can actually help solve the
problem, that extra wakeup does nothing but consume additional CPU time,
which is exactly what you don't want during a call_rcu() flood.

This commit therefore avoids doing anything if the corresponding
no-CBs callback kthread is going full tilt.  Otherwise, if advancing
callbacks immediately might help and if the leaf rcu_node structure's
lock is immediately available, this commit invokes a new variant of
rcu_advance_cbs() that advances callbacks only if doing so won't require
awakening the grace-period kthread (not to be confused with any of the
no-CBs grace-period kthreads).

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