[Devel] [PATCH rh7] sched: fair: fix dst pinned not set when failing migration due to cpulimit restriction

Vladimir Davydov vdavydov at virtuozzo.com
Wed Aug 3 06:07:02 PDT 2016


When failing task migration due to cpulimit restriction, we should set
dst pinned flag so that the load balancing procedure will proceed to the
next cpu, just like in case of failing task migration due to affinity
mask (see can_migrate_task). We don't do that since rebase to
3.10.0-327.18.2.el7. Fix that.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 kernel/sched/fair.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e39ed4c17464..cedd178f963c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5446,15 +5446,17 @@ static inline int can_migrate_task_cpulimit(struct task_struct *p, struct lb_env
 
 		schedstat_inc(p, se.statistics.nr_failed_migrations_cpulimit);
 
+		env->flags |= LBF_SOME_PINNED;
+
 		if (check_cpulimit_spread(tg, env->src_cpu) != 0)
 			return 0;
 
-		if (!env->dst_grpmask || (env->flags & LBF_SOME_PINNED))
+		if (!env->dst_grpmask || (env->flags & LBF_DST_PINNED))
 			return 0;
 
 		for_each_cpu_and(cpu, env->dst_grpmask, env->cpus) {
 			if (cfs_rq_active(tg->cfs_rq[cpu])) {
-				env->flags |= LBF_SOME_PINNED;
+				env->flags |= LBF_DST_PINNED;
 				env->new_dst_cpu = cpu;
 				break;
 			}
-- 
2.1.4



More information about the Devel mailing list