From 4196c1dafc4f7575d0940b257721125193df7aaa Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Dec 2020 14:37:17 +0100 Subject: [PATCH] Revert "ANDROID: sched: avoid migrating when softint on tgt cpu should be short" This reverts commit 8d19443b0b9b966b38327bfac69200a1ca9ed4f5 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: 31752786 Bug: 168521633 Cc: John Dias Cc: J. Avila Signed-off-by: Greg Kroah-Hartman Change-Id: I6875407b586f505c2045e4cf40682831b4fceac1 --- include/linux/interrupt.h | 7 ------- kernel/sched/rt.c | 13 ++++--------- kernel/softirq.c | 9 --------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 386ddf43e2f2..ee8299eb1f52 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -542,12 +542,6 @@ enum }; #define SOFTIRQ_STOP_IDLE_MASK (~(1 << RCU_SOFTIRQ)) -/* Softirq's where the handling might be long: */ -#define LONG_SOFTIRQ_MASK ((1 << NET_TX_SOFTIRQ) | \ - (1 << NET_RX_SOFTIRQ) | \ - (1 << BLOCK_SOFTIRQ) | \ - (1 << IRQ_POLL_SOFTIRQ) | \ - (1 << TASKLET_SOFTIRQ)) /* map softirq index to softirq name. update 'softirq_to_name' in * kernel/softirq.c when adding a new softirq. @@ -583,7 +577,6 @@ extern void raise_softirq_irqoff(unsigned int nr); extern void raise_softirq(unsigned int nr); DECLARE_PER_CPU(struct task_struct *, ksoftirqd); -DECLARE_PER_CPU(__u32, active_softirqs); static inline struct task_struct *this_cpu_ksoftirqd(void) { diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 31132b376ae3..f0dfbad724c2 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1441,20 +1441,15 @@ static int find_lowest_rq(struct task_struct *task); #ifdef CONFIG_RT_SOFTINT_OPTIMIZATION /* * Return whether the task on the given cpu is currently non-preemptible - * while handling a potentially long softint, or if the task is likely - * to block preemptions soon because it is a ksoftirq thread that is - * handling slow softints. + * while handling a softirq or is likely to block preemptions soon because + * it is a ksoftirq thread. */ bool task_may_not_preempt(struct task_struct *task, int cpu) { - __u32 softirqs = per_cpu(active_softirqs, cpu) | - __IRQ_STAT(cpu, __softirq_pending); - struct task_struct *cpu_ksoftirqd = per_cpu(ksoftirqd, cpu); - return ((softirqs & LONG_SOFTIRQ_MASK) && - (task == cpu_ksoftirqd || - task_thread_info(task)->preempt_count & SOFTIRQ_MASK)); + return (task_thread_info(task)->preempt_count & SOFTIRQ_MASK) || + task == cpu_ksoftirqd; } #endif /* CONFIG_RT_SOFTINT_OPTIMIZATION */ diff --git a/kernel/softirq.c b/kernel/softirq.c index d715589078c3..08f9f158735e 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -59,13 +59,6 @@ static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp DEFINE_PER_CPU(struct task_struct *, ksoftirqd); EXPORT_PER_CPU_SYMBOL_GPL(ksoftirqd); -/* - * active_softirqs -- per cpu, a mask of softirqs that are being handled, - * with the expectation that approximate answers are acceptable and therefore - * no synchronization. - */ -DEFINE_PER_CPU(__u32, active_softirqs); - const char * const softirq_to_name[NR_SOFTIRQS] = { "HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "IRQ_POLL", "TASKLET", "SCHED", "HRTIMER", "RCU" @@ -288,7 +281,6 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) restart: /* Reset the pending bitmask before enabling irqs */ set_softirq_pending(0); - __this_cpu_write(active_softirqs, pending); local_irq_enable(); @@ -318,7 +310,6 @@ restart: pending >>= softirq_bit; } - __this_cpu_write(active_softirqs, 0); if (__this_cpu_read(ksoftirqd) == current) rcu_softirq_qs(); local_irq_disable();