[PATCH] tick/rcu: fix an issue in the report_idle_softirq function

From: wenyang . linux
Date: Fri May 05 2023 - 07:34:30 EST


From: Wen Yang <wenyang.linux@xxxxxxxxxxx>

Commit 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle")
introduced the function report_idle_softirq, but the ratelimit logic
was broken because it is a static variable that returned before being
incremented, as follows:

static int ratelimit;
...

if (ratelimit < 10)
return false; ---> always return here
...
ratelimit++; ---> no chance to run

We need to adjust the original "< 10" logic to ">= 10".

Fixes: 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle")
Signed-off-by: Wen Yang <wenyang.linux@xxxxxxxxxxx>
Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
Cc: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
kernel/time/tick-sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index a46506f7ec6d..8891ad1d9a11 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -1035,7 +1035,7 @@ static bool report_idle_softirq(void)
return false;
}

- if (ratelimit < 10)
+ if (ratelimit >= 10)
return false;

/* On RT, softirqs handling may be waiting on some lock */
--
2.25.1