Skip to content

Commit 112b7fb

Browse files
committed
sched/fair: Do not compute NUMA Balancing stats unnecessarily during lb
JIRA: https://issues.redhat.com/browse/RHEL-78821 commit 0ac1ee9 Author: K Prateek Nayak <[email protected]> Date: Mon Dec 23 04:34:05 2024 +0000 sched/fair: Do not compute NUMA Balancing stats unnecessarily during lb Aggregate nr_numa_running and nr_preferred_running when load balancing at NUMA domains only. While at it, also move the aggregation below the idle_cpu() check since an idle CPU cannot have any preferred tasks. Signed-off-by: K Prateek Nayak <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Shrikanth Hegde <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Phil Auld <[email protected]>
1 parent c52d8c5 commit 112b7fb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

kernel/sched/fair.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9857,7 +9857,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98579857
bool *sg_overloaded,
98589858
bool *sg_overutilized)
98599859
{
9860-
int i, nr_running, local_group;
9860+
int i, nr_running, local_group, sd_flags = env->sd->flags;
98619861

98629862
memset(sgs, 0, sizeof(*sgs));
98639863

@@ -9881,10 +9881,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98819881
if (cpu_overutilized(i))
98829882
*sg_overutilized = 1;
98839883

9884-
#ifdef CONFIG_NUMA_BALANCING
9885-
sgs->nr_numa_running += rq->nr_numa_running;
9886-
sgs->nr_preferred_running += rq->nr_preferred_running;
9887-
#endif
98889884
/*
98899885
* No need to call idle_cpu() if nr_running is not 0
98909886
*/
@@ -9894,10 +9890,17 @@ static inline void update_sg_lb_stats(struct lb_env *env,
98949890
continue;
98959891
}
98969892

9893+
#ifdef CONFIG_NUMA_BALANCING
9894+
/* Only fbq_classify_group() uses this to classify NUMA groups */
9895+
if (sd_flags & SD_NUMA) {
9896+
sgs->nr_numa_running += rq->nr_numa_running;
9897+
sgs->nr_preferred_running += rq->nr_preferred_running;
9898+
}
9899+
#endif
98979900
if (local_group)
98989901
continue;
98999902

9900-
if (env->sd->flags & SD_ASYM_CPUCAPACITY) {
9903+
if (sd_flags & SD_ASYM_CPUCAPACITY) {
99019904
/* Check for a misfit task on the cpu */
99029905
if (sgs->group_misfit_task_load < rq->misfit_task_load) {
99039906
sgs->group_misfit_task_load = rq->misfit_task_load;

0 commit comments

Comments
 (0)