Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753144AbbD3U0W (ORCPT ); Thu, 30 Apr 2015 16:26:22 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:44134 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbbD3U0T convert rfc822-to-8bit (ORCPT ); Thu, 30 Apr 2015 16:26:19 -0400 Message-ID: <55428FEB.2050307@arm.com> Date: Thu, 30 Apr 2015 21:26:19 +0100 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "pang.xunlei@zte.com.cn" , Morten Rasmussen CC: Juri Lelli , "linux-kernel@vger.kernel.org" , "linux-kernel-owner@vger.kernel.org" , "mingo@redhat.com" , "mturquette@linaro.org" , "nico@linaro.org" , "peterz@infradead.org" , "preeti@linux.vnet.ibm.com" , "rjw@rjwysocki.net" , "vincent.guittot@linaro.org" , "yuyang.du@intel.com" Subject: Re: [RFCv3 PATCH 31/48] sched: Extend sched_group_energy to test load-balancing decisions References: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> <1423074685-6336-32-git-send-email-morten.rasmussen@arm.com> In-Reply-To: X-OriginalArrivalTime: 30 Apr 2015 20:26:16.0327 (UTC) FILETIME=[E8CA4970:01D08383] X-MC-Unique: 7DwG9WHAR1S8a8jl2gBzvg-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1773 Lines: 48 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. [...] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/