rcu/nocb: Optimize kthreads and rdp initialization
authorFrederic Weisbecker <frederic@kernel.org>
Tue, 23 Nov 2021 00:37:05 +0000 (01:37 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 9 Dec 2021 19:34:37 +0000 (11:34 -0800)
commita81aeaf7a1de51400374a8e3982a3cc3ff130dd1
tree734d0600330a1c896731ac4d0de7db2782b183fd
parent8d9703964697340e073305574de4f5df31a28ba9
rcu/nocb: Optimize kthreads and rdp initialization

Currently cpumask_available() is used to prevent from unwanted NOCB
initialization.  However if neither "rcu_nocbs=" nor "nohz_full="
parameters are passed to a kernel built with CONFIG_CPUMASK_OFFSTACK=n,
the initialization path is still taken, running through all sorts of
needless operations and iterations on an empty cpumask.

Fix this by relying on a real initialization state instead.  This also
optimizes kthread creation, preventing needless iteration over all online
CPUs when the kernel is booted without any offloaded CPUs.

Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Tested-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree_nocb.h