sched/fair: Exclude the current CPU from find_new_ilb()
authorPeter Zijlstra <peterz@infradead.org>
Tue, 18 Aug 2020 08:48:17 +0000 (10:48 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 29 Oct 2020 10:00:30 +0000 (11:00 +0100)
It is possible for find_new_ilb() to select the current CPU, however,
this only happens from newidle balancing, in which case need_resched()
will be true, and consequently nohz_csd_func() will not trigger the
softirq.

Exclude the current CPU from becoming an ILB target.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
kernel/sched/fair.c

index b9368d123451d358aac2cf48c1d5298fb1931c16..cd9a37c0601bbd09044b79e32972f4417d5fb777 100644 (file)
@@ -10056,6 +10056,10 @@ static inline int find_new_ilb(void)
 
        for_each_cpu_and(ilb, nohz.idle_cpus_mask,
                              housekeeping_cpumask(HK_FLAG_MISC)) {
+
+               if (ilb == smp_processor_id())
+                       continue;
+
                if (idle_cpu(ilb))
                        return ilb;
        }