Re: [PATCH v7 02/11] rcu: Make call_rcu() lazy to save power

From: Uladzislau Rezki
Date: Wed Oct 05 2022 - 07:47:07 EST


On Tue, Oct 04, 2022 at 02:41:48AM +0000, Joel Fernandes (Google) wrote:
> Implement timer-based RCU callback batching (also known as lazy
> callbacks). With this we save about 5-10% of power consumed due
> to RCU requests that happen when system is lightly loaded or idle.
>
> By default, all async callbacks (queued via call_rcu) are marked
> lazy. An alternate API call_rcu_flush() is provided for the few users,
> for example synchronize_rcu(), that need the old behavior.
>
> The batch is flushed whenever a certain amount of time has passed, or
> the batch on a particular CPU grows too big. Also memory pressure will
> flush it in a future patch.
>
> To handle several corner cases automagically (such as rcu_barrier() and
> hotplug), we re-use bypass lists which were originally introduced to
> address lock contention, to handle lazy CBs as well. The bypass list
> length has the lazy CB length included in it. A separate lazy CB length
> counter is also introduced to keep track of the number of lazy CBs.
>
> Suggested-by: Paul McKenney <paulmck@xxxxxxxxxx>
> Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
> ---
> include/linux/rcupdate.h | 7 ++
> kernel/rcu/Kconfig | 8 ++
> kernel/rcu/rcu.h | 8 ++
> kernel/rcu/tiny.c | 2 +-
> kernel/rcu/tree.c | 129 +++++++++++++++++++-----------
> kernel/rcu/tree.h | 12 ++-
> kernel/rcu/tree_exp.h | 2 +-
> kernel/rcu/tree_nocb.h | 164 +++++++++++++++++++++++++++++++--------
> 8 files changed, 246 insertions(+), 86 deletions(-)
>
Tested-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>

for whole v7 series.

--
Uladzislau Rezki