srcu: Add contention-triggered addition of srcu_node tree
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 28 Jan 2022 04:32:05 +0000 (20:32 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 8 Feb 2022 19:10:27 +0000 (11:10 -0800)
commitcf7385014590656888db644969c3ed118a9a1355
treef911d6c21d3fb66c063602087a9b029e5a884b47
parent01e1ab0de39a33ea7725e71c0735927699a2b1a9
srcu: Add contention-triggered addition of srcu_node tree

This commit instruments the acquisitions of the srcu_struct structure's
->lock, enabling the initiation of a transition from SRCU_SIZE_SMALL
to SRCU_SIZE_BIG when sufficient contention is experienced.  The
instrumentation counts the number of trylock failures within the confines
of a single jiffy.  If that number exceeds the value specified by the
srcutree.small_contention_lim kernel boot parameter (which defaults to
100), and if the value specified by the srcutree.convert_to_big kernel
boot parameter has the 0x10 bit set (defaults to 0), then a transition
will be automatically initiated.

By default, there will never be any transitions, so that none of the
srcu_struct structures ever gains an srcu_node array.

The useful values for srcutree.convert_to_big are:

0x00:  Decide conversion approach at boot given system size.
0x01:  Never convert.
0x02:  Always convert at init_srcu_struct() time.
0x03:  Convert when rcutorture prints its first round of statistics.
0x11:  Convert if contention is encountered.
0x12:  Convert if contention is encountered or when rcutorture prints
        its first round of statistics, whichever comes first.

The value 0x12 acts the same as 0x02 because the conversion happens
before there is any chance of contention.

[ paulmck: Apply "static" feedback from kernel test robot. ]

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
include/linux/srcutree.h
kernel/rcu/srcutree.c