aboutsummaryrefslogtreecommitdiff
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorPeter Zijlstra2020-07-22 10:22:02 +0200
committerPeter Zijlstra2020-07-22 10:22:02 +0200
commit015dc08918785201199ed3450c22bb8939f09dfe (patch)
tree7ba52e0b1e518fa750aaac0c1da8dd70c3eca1eb /kernel/sched/fair.c
parent9d246053a69196c7c27068870e9b4b66ac536f68 (diff)
parentd136122f58458479fd8926020ba2937de61d7f65 (diff)
Merge branch 'sched/urgent'
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r--kernel/sched/fair.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3213cb247aff..98a53a2fe354 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4047,7 +4047,11 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq)
return;
}
- rq->misfit_task_load = task_h_load(p);
+ /*
+ * Make sure that misfit_task_load will not be null even if
+ * task_h_load() returns 0.
+ */
+ rq->misfit_task_load = max_t(unsigned long, task_h_load(p), 1);
}
#else /* CONFIG_SMP */
@@ -7646,7 +7650,14 @@ static int detach_tasks(struct lb_env *env)
switch (env->migration_type) {
case migrate_load:
- load = task_h_load(p);
+ /*
+ * Depending of the number of CPUs and tasks and the
+ * cgroup hierarchy, task_h_load() can return a null
+ * value. Make sure that env->imbalance decreases
+ * otherwise detach_tasks() will stop only after
+ * detaching up to loop_max tasks.
+ */
+ load = max_t(unsigned long, task_h_load(p), 1);
if (sched_feat(LB_MIN) &&
load < 16 && !env->sd->nr_balance_failed)