diff options
author | Maria Yu <aiquny@codeaurora.org> | 2019-04-15 12:41:12 +0800 |
---|---|---|
committer | Georg Veichtlbauer <georg@vware.at> | 2023-07-16 12:47:43 +0200 |
commit | a9314f9d8ad402f17e107f2f4a11636e50301cfa (patch) | |
tree | bc648a2b640ef1f1b1da211cbd079041456781e4 | |
parent | c0b317c27d445025c40d2f3af1a052115e027e5e (diff) |
sched/fair: Allow load bigger task load balance when nr_running is 2
When there is only 2 tasks in 1 cpu and the other
task is currently running, allow load bigger task
to be balanced if the other task is currently
running.
Change-Id: I489e9624ba010f9293272a67585e8209a786b787
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
-rw-r--r-- | kernel/sched/fair.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3c0a8050b77d..941424604fdd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8953,7 +8953,17 @@ redo: if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed) goto next; - if ((load / 2) > env->imbalance) + /* + * p is not running task when we goes until here, so if p is one + * of the 2 task in src cpu rq and not the running one, + * that means it is the only task that can be balanced. + * So only when there is other tasks can be balanced or + * there is situation to ignore big task, it is needed + * to skip the task load bigger than 2*imbalance. + */ + if (((cpu_rq(env->src_cpu)->nr_running > 2) || + (env->flags & LBF_IGNORE_BIG_TASKS)) && + ((load / 2) > env->imbalance)) goto next; detach_task(p, env); |