]> git.baikalelectronics.ru Git - kernel.git/commit
rcu: Parallelize and economize NOCB kthread wakeups
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 24 Jun 2014 16:26:11 +0000 (09:26 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 7 Jul 2014 22:13:44 +0000 (15:13 -0700)
commit85bfda9d377d79f7240410f3db7e27837fc4d93b
treeb65cf880d3b4b0afd1becd66f1119f9d1ec9d853
parentac5c70d8e1ce1b40fc8d64e503e6c3a29f6834f5
rcu: Parallelize and economize NOCB kthread wakeups

An 80-CPU system with a context-switch-heavy workload can require so
many NOCB kthread wakeups that the RCU grace-period kthreads spend several
tens of percent of a CPU just awakening things.  This clearly will not
scale well: If you add enough CPUs, the RCU grace-period kthreads would
get behind, increasing grace-period latency.

To avoid this problem, this commit divides the NOCB kthreads into leaders
and followers, where the grace-period kthreads awaken the leaders each of
whom in turn awakens its followers.  By default, the number of groups of
kthreads is the square root of the number of CPUs, but this default may
be overridden using the rcutree.rcu_nocb_leader_stride boot parameter.
This reduces the number of wakeups done per grace period by the RCU
grace-period kthread by the square root of the number of CPUs, but of
course by shifting those wakeups to the leaders.  In addition, because
the leaders do grace periods on behalf of their respective followers,
the number of wakeups of the followers decreases by up to a factor of two.
Instead of being awakened once when new callbacks arrive and again
at the end of the grace period, the followers are awakened only at
the end of the grace period.

For a numerical example, in a 4096-CPU system, the grace-period kthread
would awaken 64 leaders, each of which would awaken its 63 followers
at the end of the grace period.  This compares favorably with the 79
wakeups for the grace-period kthread on an 80-CPU system.

Reported-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Documentation/kernel-parameters.txt
kernel/rcu/tree.h
kernel/rcu/tree_plugin.h