rcu/nocb: Use kthread parking instead of ad-hoc implementation
authorFrederic Weisbecker <frederic@kernel.org>
Thu, 25 Apr 2024 14:18:34 +0000 (16:18 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 4 Jun 2024 00:26:26 +0000 (17:26 -0700)
commit483d5bf23125a9127ffcb3f7a3b3539b34df67d4
tree94be520b90e9225dbd8eae3a4c18b80d1e7b5d35
parentaa97b9a56906f5965a7c5752790d174cadc8b820
rcu/nocb: Use kthread parking instead of ad-hoc implementation

Upon NOCB deoffloading, the rcuo kthread must be forced to sleep
until the corresponding rdp is ever offloaded again. The deoffloader
clears the SEGCBLIST_OFFLOADED flag, wakes up the rcuo kthread which
then notices that change and clears in turn its SEGCBLIST_KTHREAD_CB
flag before going to sleep, until it ever sees the SEGCBLIST_OFFLOADED
flag again, should a re-offloading happen.

Upon NOCB offloading, the rcuo kthread must be forced to wake up and
handle callbacks until the corresponding rdp is ever deoffloaded again.
The offloader sets the SEGCBLIST_OFFLOADED flag, wakes up the rcuo
kthread which then notices that change and sets in turn its
SEGCBLIST_KTHREAD_CB flag before going to check callbacks, until it
ever sees the SEGCBLIST_OFFLOADED flag cleared again, should a
de-offloading happen again.

This is all a crude ad-hoc and error-prone kthread (un-)parking
re-implementation.

Consolidate the behaviour with the appropriate API instead.

[ paulmck: Apply Qiang Zhang feedback provided in Link: below. ]
Link: https://lore.kernel.org/all/20240509074046.15629-1-qiang.zhang1211@gmail.com/
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
include/linux/rcu_segcblist.h
kernel/rcu/tree_nocb.h
kernel/rcu/tree_plugin.h