]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sched/fair: Skip idle cfs_rq
authorVincent Guittot <vincent.guittot@linaro.org>
Thu, 7 Jan 2021 10:33:23 +0000 (11:33 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 14 Jan 2021 10:20:10 +0000 (11:20 +0100)
Don't waste time checking whether an idle cfs_rq could be the busiest
queue. Furthermore, this can end up selecting a cfs_rq with a high load
but being idle in case of migrate_load.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lkml.kernel.org/r/20210107103325.30851-2-vincent.guittot@linaro.org
kernel/sched/fair.c

index 40d3ebfb5a486a116d2350ab3f58744e63005f01..13de7aede74f1f41764931d01bdddafd3bbb25be 100644 (file)
@@ -9402,8 +9402,11 @@ static struct rq *find_busiest_queue(struct lb_env *env,
                if (rt > env->fbq_type)
                        continue;
 
-               capacity = capacity_of(i);
                nr_running = rq->cfs.h_nr_running;
+               if (!nr_running)
+                       continue;
+
+               capacity = capacity_of(i);
 
                /*
                 * For ASYM_CPUCAPACITY domains, don't pick a CPU that could