rcu/nocb: Avoid polling when my_rdp->nocb_head_rdp list is empty
authorZqiang <qiang1.zhang@intel.com>
Sat, 11 Jun 2022 11:00:44 +0000 (19:00 +0800)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 19 Jul 2022 18:43:55 +0000 (11:43 -0700)
commit0578e14c945b1739e15c0e993280151fa5b99ca2
treebcb0ae51624fc80e727f1095346b9329d3ea1a39
parent8f489b4da5278fc6e5fc8f0029ae7fb51c060215
rcu/nocb: Avoid polling when my_rdp->nocb_head_rdp list is empty

Currently, if the 'rcu_nocb_poll' kernel boot parameter is enabled, all
rcuog kthreads enter polling mode.  However, if all of a given group
of rcuo kthreads correspond to CPUs that have been de-offloaded, the
corresponding rcuog kthread will nonetheless still wake up periodically,
unnecessarily consuming power and perturbing workloads.  Fortunately,
this situation is easily detected by the fact that the rcuog kthread's
CPU's rcu_data structure's ->nocb_head_rdp list is empty.

This commit saves power and avoids unnecessarily perturbing workloads
by putting an rcuog kthread to sleep during any time period when all of
its rcuo kthreads' CPUs are de-offloaded.

Co-developed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
kernel/rcu/tree_nocb.h