Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4969596imm; Tue, 19 Jun 2018 02:55:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKmR+zh9tducENNr6/q/wglku7J8yINFB7VWyxkU4S7rO7L1uWjyVxoz4u+rnZWpoz7zEJT X-Received: by 2002:a62:e097:: with SMTP id d23-v6mr17374358pfm.81.1529402108793; Tue, 19 Jun 2018 02:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529402108; cv=none; d=google.com; s=arc-20160816; b=tcu2UhzeBlMYLLz9qow1mz+jUJa2akju7RxvAAzdeyxMQW5t4822c3x5A7RIAHPxVq tX6/9fD2fNQpAJye8VXovRpDgiol/hC+xT+9AqABxw3BI7ocwLIFlo3eKNaHf65S8PYf XWJhcRNllz5YTowKsYubt3R8gRmDnylmFTBHhF4GPU1upGRsNAD4XXPlEnuTYv4cipAC Uvbrbmqku6XcOUTvTy/7Hm19YrkbISsR1AVtUcPx0NwZQhnCYYL6UrVJrbqlBuzVCPhk lR/GaTbX6HcesWLm0I8vwXg5tZsoA4JXqnI4wGIxRlxWQGWC6iBgJRNlfDxfuwhBZKJh exOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=R9nOvbSYPTqB768Tj3unKwAeGYja4fVFspdcLw5Niik=; b=GromaRNg07ftPvQsoUZP+S0PFYpuTVovwXzxwAEdvbShev3VAzwrKKWugBODOdSJMY txkD+nAN8Shb+UToreOk7QJL6g/1ka1HPaXHRYHUYKpN8EFdDPZOWSwKqwVXEe9CSVqC uXCwgxzwN9jOBtrTsmiXe1tp8S3FAR9U09hGPWUArd+x7wRPWdWjFphbL1BCzV+8vaJT 7Y8ARO9m7KNmVOe/q9KRDdI2cgdxWiquXuO4sJ4ERyoVQX7D2CnY8+p4Wq77NmaU/Oa0 KlMTTPDDe8Y4mdxv1zsvcvHIeZuPZyPdbQOb98wETpuo807XP34wvLdLk2gBQNr1XV37 l9pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si17731190plr.131.2018.06.19.02.54.55; Tue, 19 Jun 2018 02:55:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937392AbeFSJxr (ORCPT + 99 others); Tue, 19 Jun 2018 05:53:47 -0400 Received: from foss.arm.com ([217.140.101.70]:46118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936108AbeFSJxq (ORCPT ); Tue, 19 Jun 2018 05:53:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D2D5F1435; Tue, 19 Jun 2018 02:53:45 -0700 (PDT) Received: from e108498-lin.cambridge.arm.com (e108498-lin.cambridge.arm.com [10.1.211.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DDC583F25D; Tue, 19 Jun 2018 02:53:41 -0700 (PDT) Date: Tue, 19 Jun 2018 10:53:40 +0100 From: Quentin Perret To: Pavan Kondeti Cc: peterz@infradead.org, rjw@rjwysocki.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joelaf@google.com, smuckle@google.com, adharmap@quicinc.com, skannan@quicinc.com, juri.lelli@redhat.com, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net, javi.merino@kernel.org Subject: Re: [RFC PATCH v3 07/10] sched/fair: Introduce an energy estimation helper function Message-ID: <20180619095340.GS17720@e108498-lin.cambridge.arm.com> References: <20180521142505.6522-1-quentin.perret@arm.com> <20180521142505.6522-8-quentin.perret@arm.com> <20180619095140.GE9208@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180619095140.GE9208@codeaurora.org> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 19 Jun 2018 at 15:21:40 (+0530), Pavan Kondeti wrote: > On Mon, May 21, 2018 at 03:25:02PM +0100, Quentin Perret wrote: > > > > > > > +/* > > + * Returns the util of "cpu" if "p" wakes up on "dst_cpu". > > + */ > > +static unsigned long cpu_util_next(int cpu, struct task_struct *p, int dst_cpu) > > +{ > > + unsigned long util, util_est; > > + struct cfs_rq *cfs_rq; > > + > > + /* Task is where it should be, or has no impact on cpu */ > > + if ((task_cpu(p) == dst_cpu) || (cpu != task_cpu(p) && cpu != dst_cpu)) > > + return cpu_util(cpu); > > + > > + cfs_rq = &cpu_rq(cpu)->cfs; > > + util = READ_ONCE(cfs_rq->avg.util_avg); > > + > > + if (dst_cpu == cpu) > > + util += task_util(p); > > + else > > + util = max_t(long, util - task_util(p), 0); > > + > > + if (sched_feat(UTIL_EST)) { > > + util_est = READ_ONCE(cfs_rq->avg.util_est.enqueued); > > + if (dst_cpu == cpu) > > + util_est += _task_util_est(p); > > + else > > + util_est = max_t(long, util_est - _task_util_est(p), 0); > > For UTIL_EST case, the waking task will not have any contribution in the > previous CPU's util_est. So we can just use the previous CPU util_est as is. Right, good catch, I actually spotted that one as well and already fixed it for v4 ;-)