Skip to content

Commit 9ee95b8

Browse files
committed
sched/fair: Do not compute overloaded status unnecessarily during lb
JIRA: https://issues.redhat.com/browse/RHEL-78821 commit 3229adb Author: K Prateek Nayak <[email protected]> Date: Mon Dec 23 04:34:06 2024 +0000 sched/fair: Do not compute overloaded status unnecessarily during lb Only set sg_overloaded when computing sg_lb_stats() at the highest sched domain since rd->overloaded status is updated only when load balancing at the highest domain. While at it, move setting of sg_overloaded below idle_cpu() check since an idle CPU can never be overloaded. Signed-off-by: K Prateek Nayak <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Reviewed-by: Shrikanth Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Phil Auld <[email protected]>
1 parent 112b7fb commit 9ee95b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kernel/sched/fair.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9858,6 +9858,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98589858
bool *sg_overutilized)
98599859
{
98609860
int i, nr_running, local_group, sd_flags = env->sd->flags;
9861+
bool balancing_at_rd = !env->sd->parent;
98619862

98629863
memset(sgs, 0, sizeof(*sgs));
98639864

@@ -9875,9 +9876,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98759876
nr_running = rq->nr_running;
98769877
sgs->sum_nr_running += nr_running;
98779878

9878-
if (nr_running > 1)
9879-
*sg_overloaded = 1;
9880-
98819879
if (cpu_overutilized(i))
98829880
*sg_overutilized = 1;
98839881

@@ -9890,6 +9888,10 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98909888
continue;
98919889
}
98929890

9891+
/* Overload indicator is only updated at root domain */
9892+
if (balancing_at_rd && nr_running > 1)
9893+
*sg_overloaded = 1;
9894+
98939895
#ifdef CONFIG_NUMA_BALANCING
98949896
/* Only fbq_classify_group() uses this to classify NUMA groups */
98959897
if (sd_flags & SD_NUMA) {

0 commit comments

Comments
 (0)