Skip to content

Commit eda0333

Browse files
Pavankumar KondetiExactExampl
authored andcommitted
sched/fair: Fix redundant load balancer reattempt due to LBF_ALL_PINNED
LBF_ALL_PINNED flag should cleared in can_migrate_task() if the task can run on the destination CPU during load balance. In current code, can_migrate_task() return incorrectly without clearing this flag in case if the task can't be migrated to the destination CPU due to cumulative window demand constraints. Since LBF_ALL_PINNED flag is not cleared, load balancer thinks that none of the tasks running on the busiest group can't be migrated to the destination CPU due to affinity settings and tries to find another busiest group. Prevent this incorrect reattempt of load balance by clearing LBF_ALL_PINNED flag right after the task affinity check in can_migrate_task(). Change-Id: Iad1cf42b1aaf70106ee5ecfbd9499ccb6eb7497e [clingutla@codeaurora.org: Resolved merge conflicts] Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> (cherry picked from commit 5ee367fc9386d4e36af644942d9d10f97827bab1)
1 parent 7af632d commit eda0333

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

kernel/sched/fair.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8443,6 +8443,9 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
84438443
return 0;
84448444
}
84458445

8446+
/* Record that we found atleast one task that could run on dst_cpu */
8447+
env->flags &= ~LBF_ALL_PINNED;
8448+
84468449
if (energy_aware() && !env->dst_rq->rd->overutilized &&
84478450
env->idle == CPU_NEWLY_IDLE) {
84488451
long util_cum_dst, util_cum_src;
@@ -8456,9 +8459,6 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
84568459
return 0;
84578460
}
84588461

8459-
/* Record that we found atleast one task that could run on dst_cpu */
8460-
env->flags &= ~LBF_ALL_PINNED;
8461-
84628462
#ifdef CONFIG_SCHED_WALT
84638463
if (env->flags & LBF_IGNORE_PREFERRED_CLUSTER_TASKS &&
84648464
!preferred_cluster(cpu_rq(env->dst_cpu)->cluster, p))

0 commit comments

Comments
 (0)