lkml.org 
[lkml]   [2020]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 1/1] Softirq:avoid large sched delay from the pending softirqs
Date
From: jun qian <qianjun.kernel@gmail.com>

When get the pending softirqs, it need to process all the pending
softirqs in the while loop. If the processing time of each pending
softirq is need more than 2 msec in this loop, or one of the softirq
will running a long time, according to the original code logic, it
will process all the pending softirqs without wakeuping ksoftirqd,
which will cause a relatively large scheduling delay on the
corresponding CPU, which we do not wish to see. The patch will check
the total time to process pending softirq, if the time exceeds 2 ms
we need to wakeup the ksofirqd to aviod large sched delay.

Signed-off-by: jun qian <qianjun.kernel@gmail.com>
---
kernel/softirq.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index c4201b7f..602d9fa 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -299,6 +299,9 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
}
h++;
pending >>= softirq_bit;
+
+ if (time_after(jiffies, end) && need_resched())
+ break;
}

if (__this_cpu_read(ksoftirqd) == current)
--
1.8.3.1
\
 
 \ /
  Last update: 2020-07-17 08:39    [W:0.764 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site