| Date | Thu, 30 Apr 2015 21:26:19 +0100 | From | Dietmar Eggemann <> | Subject | Re: [RFCv3 PATCH 31/48] sched: Extend sched_group_energy to test load-balancing decisions |
| |
On 30/04/15 08:00, pang.xunlei@zte.com.cn wrote: > linux-kernel-owner@vger.kernel.org wrote 2015-02-05 AM 02:31:08:
[...]
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index d12aa63..07c84af 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -4592,23 +4592,44 @@ static unsigned long capacity_curr_of(int cpu) >> * Without capping the usage, a group could be seen as overloaded > (CPU0 usage >> * at 121% + CPU1 usage at 80%) whereas CPU1 has 20% of available > capacity/ >> */ >> -static int get_cpu_usage(int cpu) >> +static int __get_cpu_usage(int cpu, int delta) >> { >> + int sum; >> unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg; >> unsigned long blocked = cpu_rq(cpu)->cfs.utilization_blocked_avg; >> unsigned long capacity_curr = capacity_curr_of(cpu); >> >> - if (usage + blocked >= capacity_curr) >> + sum = usage + blocked + delta; >> + >> + if (sum < 0) >> + return 0; >> + >> + if (sum >= capacity_curr) >> return capacity_curr; > > So if the added delta exceeds the curr capacity not its orignal capacity > which I think would be quite often cases, I guess it should be better if > it's allowed to increase its freq and calculate the right energy diff.
Yes, I mentioned this in my answer for [RFCv3 PATCH 17/48] that our testing in the meantime has shown that this capping by capacity_curr is the wrong approach in some cases and that we are likely to change this to capacity_orig_of(cpu) in the next version.
[...]
|