linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] softirq: wake up ktimer thread in softirq context
@ 2022-12-08  7:56 Junxiao Chang
  2022-12-20 10:44 ` Chang, Junxiao
  2023-02-17 17:30 ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 11+ messages in thread
From: Junxiao Chang @ 2022-12-08  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-rt-users, bigeasy, tglx, rostedt, junxiao.chang, hock.zhang.peh

Occiaionally timer interrupt might be triggered in softirq context,
ktimer thread should be woken up with RT kernel, or else ktimer
thread might stay in sleep state although timer interrupt has been
triggered.

This change fixes a latency issue that timer handler is delayed for
more than 4ms in network related test.

Fixes: 2165d27554e8 ("softirq: Use a dedicated thread for timer wakeups.")
Reported-by: Peh, Hock Zhang <hock.zhang.peh@intel.com>
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
---
 kernel/softirq.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index ab1fe34326bab..34ae39e4a3d10 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -664,13 +664,10 @@ static inline void __irq_exit_rcu(void)
 #endif
 	account_hardirq_exit(current);
 	preempt_count_sub(HARDIRQ_OFFSET);
-	if (!in_interrupt()) {
-		if (local_softirq_pending())
-			invoke_softirq();
-
-		if (IS_ENABLED(CONFIG_PREEMPT_RT) && local_pending_timers())
-			wake_timersd();
-	}
+	if (!in_interrupt() && local_softirq_pending())
+		invoke_softirq();
+	if (!(in_nmi() || in_hardirq()) && local_pending_timers())
+		wake_timersd();
 
 	tick_irq_exit();
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-02-20 10:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08  7:56 [PATCH] softirq: wake up ktimer thread in softirq context Junxiao Chang
2022-12-20 10:44 ` Chang, Junxiao
2022-12-20 17:10   ` Alison Chaiken
2022-12-20 18:02   ` bigeasy
2022-12-20 19:28     ` Alison Chaiken
2023-01-23 18:04     ` Alison Chaiken
2023-02-10 15:32     ` Alison Chaiken
2023-02-10 16:33       ` bigeasy
2023-02-17 17:30 ` Sebastian Andrzej Siewior
2023-02-20  8:55   ` Chang, Junxiao
2023-02-20 10:53     ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).