--- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -521,6 +521,7 @@ asmlinkage __visible void __softirq_entr bool in_hardirq; __u32 pending; int softirq_bit; + bool is_ksoftirqd = __this_cpu_read(ksoftirqd) == current; /* * Mask out PF_MEMALLOC as the current task context is borrowed for the @@ -565,6 +566,8 @@ restart: } h++; pending >>= softirq_bit; + if (is_ksoftirqd && in_task()) + cond_resched(); } if (!IS_ENABLED(CONFIG_PREEMPT_RT) &&