Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9507ba3 authored by Leo Yan's avatar Leo Yan Committed by Joonwoo Park
Browse files

sched/fair: fix for group_smaller_cpu_capacity()



Function group_smaller_cpu_capacity() checks if one schedule group has
smaller capacity than another one:

return sg->sgc->max_capacity + capacity_margin - SCHED_LOAD_SCALE <
					ref->sgc->max_capacity;

The value (capacity_margin - SCHED_LOAD_SCALE) is an absolute value for
difference checking, so it's easily broken if two scheduler groups have
no much difference (like CA53.Fast+CA53.Slow system).

When this function is invalid the schedule group with misfit tasks
will be wrongly cleared flag so misfit task has no chance to migrate to
higher capacity CPU.

This patch is to directly check schedule group maximum_capacity and has
a minor fix for maximum_capacity assignment with original capacity.

Change-Id: I8071f2ee90e0823c3232018bdbf27e759fba0ec1
Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
Patch-mainline: eas-dev @ 12/22/16, 15:58
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent f95e8dee
Loading
Loading
Loading
Loading

kernel/sched/fair.c

100644 → 100755
+3 −3
Original line number Diff line number Diff line
@@ -8048,6 +8048,8 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)
	raw_spin_unlock_irqrestore(&mcc->lock, flags);

skip_unlock: __attribute__ ((unused));
	sdg->sgc->max_capacity = capacity;

	capacity *= scale_rt_capacity(cpu);
	capacity >>= SCHED_CAPACITY_SHIFT;

@@ -8056,7 +8058,6 @@ skip_unlock: __attribute__ ((unused));

	cpu_rq(cpu)->cpu_capacity = capacity;
	sdg->sgc->capacity = capacity;
	sdg->sgc->max_capacity = capacity;
}

void update_group_capacity(struct sched_domain *sd, int cpu)
@@ -8234,8 +8235,7 @@ group_is_overloaded(struct lb_env *env, struct sg_lb_stats *sgs)
static inline bool
group_smaller_cpu_capacity(struct sched_group *sg, struct sched_group *ref)
{
	return sg->sgc->max_capacity + capacity_margin - SCHED_CAPACITY_SHIFT <
							ref->sgc->max_capacity;
	return sg->sgc->max_capacity < ref->sgc->max_capacity;
}

static inline enum