Revert "ANDROID: Revert "softirq: Let ksoftirqd do its job""

This reverts commit 1bcefd3883  as the
softirq code is rewritten in 5.11-rc1 and massive merge conflicts are
happening.

If this change is still needed, please work with upstream to get the
patches accepted so they can then come into this tree automatically.

Bug: 168521633
Cc: Lingutla Chandrasekhar <clingutla@codeaurora.org>
Cc: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Cc: J. Avila <elavila@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idb615a68b4e892b1b0391a8511c9338f6202368b
This commit is contained in:
Greg Kroah-Hartman 2020-12-18 14:36:57 +01:00
parent 2cadcbac1a
commit c646ea5a5f

View File

@ -86,6 +86,18 @@ static void wakeup_softirqd(void)
wake_up_process(tsk);
}
/*
* If ksoftirqd is scheduled, we do not want to process pending softirqs
* right now. Let ksoftirqd handle this at its own rate, to get fairness.
*/
static bool ksoftirqd_running(void)
{
struct task_struct *tsk = __this_cpu_read(ksoftirqd);
return tsk && (tsk->state == TASK_RUNNING) &&
!__kthread_should_park(tsk);
}
/*
* preempt_count and SOFTIRQ_OFFSET usage:
* - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
@ -350,7 +362,7 @@ asmlinkage __visible void do_softirq(void)
pending = local_softirq_pending();
if (pending)
if (pending && !ksoftirqd_running())
do_softirq_own_stack();
local_irq_restore(flags);
@ -384,6 +396,9 @@ void irq_enter(void)
static inline void invoke_softirq(void)
{
if (ksoftirqd_running())
return;
if (!force_irqthreads) {
#ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
/*