Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751190AbbD3UfK (ORCPT ); Thu, 30 Apr 2015 16:35:10 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:26407 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbbD3UfH convert rfc822-to-8bit (ORCPT ); Thu, 30 Apr 2015 16:35:07 -0400 Message-ID: <554291F8.1070700@arm.com> Date: Thu, 30 Apr 2015 21:35:04 +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" CC: Juri Lelli , "linux-kernel@vger.kernel.org" , "linux-kernel-owner@vger.kernel.org" , "mingo@redhat.com" , Morten Rasmussen , "mturquette@linaro.org" , "nico@linaro.org" , Peter Boonstoppel , "peterz@infradead.org" , "preeti@linux.vnet.ibm.com" , "rjw@rjwysocki.net" , Sai Gurrappadi , "vincent.guittot@linaro.org" , "yuyang.du@intel.com" Subject: Re: [RFCv3 PATCH 43/48] sched: Introduce energy awareness into detach_tasks References: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> <1423074685-6336-44-git-send-email-morten.rasmussen@arm.com> <551349D0.8070402@nvidia.com> <5515713C.3060509@arm.com> In-Reply-To: X-OriginalArrivalTime: 30 Apr 2015 20:35:02.0782 (UTC) FILETIME=[2294F1E0:01D08385] X-MC-Unique: SB7E0wqDRBuCEaoSEbiRBg-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: 2729 Lines: 68 On 30/04/15 08:12, pang.xunlei@zte.com.cn wrote: > linux-kernel-owner@vger.kernel.org wrote 2015-03-27 PM 11:03:24: >> Re: [RFCv3 PATCH 43/48] sched: Introduce energy awareness into > detach_tasks [...] >> > Hi Morten, Dietmar, >> > >> > Wouldn't the above energy_diff() use the 'old' value of dst_cpu's util? >> > Tasks are detached/dequeued in this loop so they have their util >> > contrib. removed from src_cpu but their contrib. hasn't been added to >> > dst_cpu yet (happens in attach_tasks). >> >> You're absolutely right Sai. Thanks for pointing this out! I guess I > rather >> have to accumulate the usage of tasks I've detached and add this to the >> eenv::usage_delta of the energy_diff() call for the next task. >> >> Something like this (only slightly tested): >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 8d4cc72f4778..d0d0e965fd0c 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -6097,6 +6097,7 @@ static int detach_tasks(struct lb_env *env) >> struct task_struct *p; >> unsigned long load = 0; >> int detached = 0; >> + int usage_delta = 0; >> >> lockdep_assert_held(&env->src_rq->lock); >> >> @@ -6122,16 +6123,19 @@ static int detach_tasks(struct lb_env *env) >> goto next; >> >> if (env->use_ea) { >> + int util = task_utilization(p); >> struct energy_env eenv = { >> .src_cpu = env->src_cpu, >> .dst_cpu = env->dst_cpu, >> - .usage_delta = task_utilization(p), >> + .usage_delta = usage_delta + util, >> }; >> int e_diff = energy_diff(&eenv); > > If any or total utilization of tasks detached exceeds the orig capacity, > of src_cpu, should we bail out in case of performance plus avoiding > reaching the tipping point easily(because in such cases, src_cpu tends > to be ended up overutilized)? Yes, correct. We have to limit the dst cpu from pulling more than its remaining capacity worth of usage. I already integrated a check that the dst cpu is not over-utilized by taking the usage_delta. > Also like what I just replied to "[RFCv4 PATCH 31/48]", when doing > energy_diff() it should be allowed to exceed cur capacity if not > reaching its original capacity(is capacity_of(cpu) better?). True. [...] -- 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/