Skip to content

Commit 0ac1ee9

Browse files
kudureranganathPeter Zijlstra
authored andcommitted
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]
1 parent e1bc026 commit 0ac1ee9

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
@@ -10409,7 +10409,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1040910409
bool *sg_overloaded,
1041010410
bool *sg_overutilized)
1041110411
{
10412-
int i, nr_running, local_group;
10412+
int i, nr_running, local_group, sd_flags = env->sd->flags;
1041310413

1041410414
memset(sgs, 0, sizeof(*sgs));
1041510415

@@ -10433,10 +10433,6 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1043310433
if (cpu_overutilized(i))
1043410434
*sg_overutilized = 1;
1043510435

10436-
#ifdef CONFIG_NUMA_BALANCING
10437-
sgs->nr_numa_running += rq->nr_numa_running;
10438-
sgs->nr_preferred_running += rq->nr_preferred_running;
10439-
#endif
1044010436
/*
1044110437
* No need to call idle_cpu() if nr_running is not 0
1044210438
*/
@@ -10446,10 +10442,17 @@ static inline void update_sg_lb_stats(struct lb_env *env,
1044610442
continue;
1044710443
}
1044810444

10445+
#ifdef CONFIG_NUMA_BALANCING
10446+
/* Only fbq_classify_group() uses this to classify NUMA groups */
10447+
if (sd_flags & SD_NUMA) {
10448+
sgs->nr_numa_running += rq->nr_numa_running;
10449+
sgs->nr_preferred_running += rq->nr_preferred_running;
10450+
}
10451+
#endif
1044910452
if (local_group)
1045010453
continue;
1045110454

10452-
if (env->sd->flags & SD_ASYM_CPUCAPACITY) {
10455+
if (sd_flags & SD_ASYM_CPUCAPACITY) {
1045310456
/* Check for a misfit task on the cpu */
1045410457
if (sgs->group_misfit_task_load < rq->misfit_task_load) {
1045510458
sgs->group_misfit_task_load = rq->misfit_task_load;

0 commit comments

Comments
 (0)