[PATCH] rcu: Add nocb_cb_kthread check to rcu_is_callbacks_kthread()

From: Zqiang
Date: Mon Apr 25 2022 - 04:23:21 EST


At present, there are two situations which the rcu callback function
be exectued in the kthreads, one is if the use_softirq is set to zero,
the RCU_SOFTIRQ processing is carried out by the per-CPU rcuc kthreads,
for non-offload rdp, the rdp's rcu callback function be exectued in rcuc
kthreads. another one is if the rdp is set to offloaded, the rdp's rcu
callback function be exected in the rcuop kthreads.

Signed-off-by: Zqiang <qiang1.zhang@xxxxxxxxx>
---
kernel/rcu/tree_plugin.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 971bb6a00ede..845dbfc876a2 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1157,7 +1157,8 @@ static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags)
*/
static bool rcu_is_callbacks_kthread(void)
{
- return __this_cpu_read(rcu_data.rcu_cpu_kthread_task) == current;
+ return __this_cpu_read(rcu_data.rcu_cpu_kthread_task) == current ||
+ __this_cpu_read(rcu_data.nocb_cb_kthread) == current;
}

#define RCU_BOOST_DELAY_JIFFIES DIV_ROUND_UP(CONFIG_RCU_BOOST_DELAY * HZ, 1000)
--
2.25.1