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>
Thu, 24 Feb 2022 17:50:10 +0000 (09:50 -0800)
commit4404bd4f956dac9559cdbe6636a08a59ffe9cd45
tree5be0f966872567b1822b3d90187d2ea4c71b9ba9
parent01fe51a226f5efd3a6a8d73a4d5b39dff1d29478
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