Commit 4e2dcb73 authored by Zhang Hang's avatar Zhang Hang Committed by Ingo Molnar

sched: Simplify can_migrate_task()

At this point tsk_cache_hot is always true, so no need to check it.
Signed-off-by: default avatarZhang Hang <bob.zhanghang@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/51650107.9040606@huawei.com
[ Also remove unnecessary schedstat #ifdefs. ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 28b4a521
...@@ -3921,20 +3921,17 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) ...@@ -3921,20 +3921,17 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
tsk_cache_hot = task_hot(p, env->src_rq->clock_task, env->sd); tsk_cache_hot = task_hot(p, env->src_rq->clock_task, env->sd);
if (!tsk_cache_hot || if (!tsk_cache_hot ||
env->sd->nr_balance_failed > env->sd->cache_nice_tries) { env->sd->nr_balance_failed > env->sd->cache_nice_tries) {
#ifdef CONFIG_SCHEDSTATS
if (tsk_cache_hot) { if (tsk_cache_hot) {
schedstat_inc(env->sd, lb_hot_gained[env->idle]); schedstat_inc(env->sd, lb_hot_gained[env->idle]);
schedstat_inc(p, se.statistics.nr_forced_migrations); schedstat_inc(p, se.statistics.nr_forced_migrations);
} }
#endif
return 1; return 1;
} }
if (tsk_cache_hot) { schedstat_inc(p, se.statistics.nr_failed_migrations_hot);
schedstat_inc(p, se.statistics.nr_failed_migrations_hot); return 0;
return 0;
}
return 1;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment