Function task_fits_max() checks if CPU maximum capacity can meet task requirement. So it gets CPU capacity by using capacity_of(), this value is CPU maximum capacity - bandwidth occupied by RT threads. So sometimes capacity_of() is a bit less than CPU original capacity if the CPU has RT threads on it. As an amendment for RT threads, function task_fits_max() uses more flexible condition to check if the CPU can meet task requirement, this is finished by below condition:
if (capacity * capacity_margin > max_capacity * 1024) return true;
This condition introduces some unexpected result if the two clusters have small difference so even the lower capacity cluster can easily reach this criteria. So finally all CPUs can meet this condition and is always invalid for misfit task checking..
This patch is to go back to use capacity_orig_of() to get CPU capacity and if CPU is highest capacity CPU then always return true, otherwise it will run detailed flow, this also includes the case when CPU has RT threads on it.
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7b1f65b..2ae55f6 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5074,15 +5074,12 @@ static inline bool __task_fits(struct task_struct *p, int cpu, int util)
static inline bool task_fits_max(struct task_struct *p, int cpu) { - unsigned long capacity = capacity_of(cpu); + unsigned long capacity = capacity_orig_of(cpu); unsigned long max_capacity = cpu_rq(cpu)->rd->max_cpu_capacity.val;
if (capacity == max_capacity) return true;
- if (capacity * capacity_margin > max_capacity * 1024) - return true; - return __task_fits(p, cpu, 0); }
-- 2.7.4