[PATCH] rcu/tree: nocb: Avoid raising softirq when CBs ready to execute

From: Joel Fernandes (Google)
Date: Mon Sep 28 2020 - 08:46:45 EST


During testing, I see it is possible that rcu_pending() returns 1 when
offloaded callbacks are ready to execute thus raising the RCU softirq.

However, softirq does not execute offloaded callbacks. They are executed in a
kthread which is awakened independent of the softirq. The softirq ignores the
request.

This commit therefore avoids raising the softirq in the first place.
Considering that the purpose of callback offloading is to reduce softirq
activity, avoiding the softirq in the first place is the right thing to do
especially for systems that employ callback offloading to reduce real-time
jitter.

Passed 30 minute tests of TREE01 through TREE09 each.

Cc: neeraju@xxxxxxxxxxxxxx
Cc: fweisbec@xxxxxxxxx
Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>

---
kernel/rcu/tree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 55d3700dd1e7..caea5bfec2c0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3759,7 +3759,8 @@ static int rcu_pending(int user)
return 1;

/* Does this CPU have callbacks ready to invoke? */
- if (rcu_segcblist_ready_cbs(&rdp->cblist))
+ if (!rcu_segcblist_is_offloaded(&rdp->cblist) &&
+ rcu_segcblist_ready_cbs(&rdp->cblist))
return 1;

/* Has RCU gone idle with this CPU needing another grace period? */
--
2.28.0.709.gb0816b6eb0-goog