Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4967886imm; Tue, 19 Jun 2018 02:52:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKnjtOULm2IVgxHk6yh30qQKqir7DE/B58pcYmLl1YeW9j01DzMXS4N6fg4HguktatRedIl X-Received: by 2002:a62:d74d:: with SMTP id v13-v6mr17531243pfl.0.1529401979585; Tue, 19 Jun 2018 02:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529401979; cv=none; d=google.com; s=arc-20160816; b=AaV6E1YA32CF/eo5eZ6e4pvNWX7Uo+2iTv3gUpPVR6p7LoDTYDMNsXGKe0IYIpmvFj NT46h9D2wHZKUqmMaUjSYrvJlW9sRkp5+/W2zkIOro/axPQD1bxAQDnJ6mL3eZdzHloz HEZJ9n2o3Tizvqh8tnHhM6Fg/E5yFBMGBYTJj/Et+ZdzWKAv8XfAjcY0RXIe07BivnLH DagkKC8F4zhYR/GYCEn2dkwijW9DHojRSQa2cpYTGaY/WfpfHrodIf3U3eI3upyPLHDh tQfKXEDtIgGv0BoOK+OG3pNFu+h2Rh45T6FK0KTnsiRLyp2Um/XU7Kglzie0mUnPt7Lm rrFg== 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:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=sExvnkvHbK20uxinSjRlztHZxo/EJtsfyK7jHrbdHLk=; b=sEO1LWSZRzoh0rofvhJn7toKc/q1/XWzeW0WyeOkUHSYMaSNveL75y4wI3VzkxQfZg X8VQWZxmU37onHm5M8WiJLGyu+fSoV2IAfGjSLP1Hw8oVIWhYDCiri5y8IhoYN2yVcnU 7R+6tD0DQOrwM11lP22vBXHYuLcj5yTgdmIOGrnsuvRnRTnF6tWe7GzqyUMxrlbxbYSb e4NcMFWidmhNOiZy7p6LUMVhwC1GSDqOLP/WXyijrthXvfZwFoJSaZCu9Il0ZBY/+lVN NIrTcWZQXxQsYkG2W/eNRgXL8mBhKpOZJSPOrch47Zhgg7eRuuAjkZYHLzOOuoNn2SDV FM3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=S5tj3Bwa; dkim=pass header.i=@codeaurora.org header.s=default header.b=pMhSTd1m; 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 e2-v6si13729401pgr.167.2018.06.19.02.52.45; Tue, 19 Jun 2018 02:52:59 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=S5tj3Bwa; dkim=pass header.i=@codeaurora.org header.s=default header.b=pMhSTd1m; 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 S965437AbeFSJvx (ORCPT + 99 others); Tue, 19 Jun 2018 05:51:53 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55294 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755270AbeFSJvv (ORCPT ); Tue, 19 Jun 2018 05:51:51 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B733560B1A; Tue, 19 Jun 2018 09:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529401910; bh=KMPtYJ1oyhWweIy+Eqz+kmopH5bbpNwl04WuxXPDbJg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S5tj3BwalSyozE2ZpoCMugfaKfI38RBdYbN8llu/HpbjbaH4bXXFxLTus1puX8jd8 2AHhiF9DnvPdz5gypiU/ybJ1PHPhSxBr9jskzYMfz+AUj4uWt8ulVMMxu/B6fIuRgx yESEfIm5L2QyVisc2lBkHVonTOgVfIsN8vvyhE04= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: pkondeti@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 54F30604A6; Tue, 19 Jun 2018 09:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529401909; bh=KMPtYJ1oyhWweIy+Eqz+kmopH5bbpNwl04WuxXPDbJg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pMhSTd1mMpdET6cVZhZ1bIHlH35xRFKjBuFqK2fhKJC8AOH6yk29BSJ2Q8f5gXs86 cGnKHrsAxLyKCl8oGajGbsnErPvJaZSb95HDQlY099FdZP2HYNxCMQ3iKTXJKED4Z+ ZEnZW1iY07rwp+3waj0Ku4CoXbhDT2DWz6YeOzkk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 54F30604A6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pkondeti@codeaurora.org Date: Tue, 19 Jun 2018 15:21:40 +0530 From: Pavan Kondeti To: Quentin Perret 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: <20180619095140.GE9208@codeaurora.org> References: <20180521142505.6522-1-quentin.perret@arm.com> <20180521142505.6522-8-quentin.perret@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521142505.6522-8-quentin.perret@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + util = max(util, util_est); > + } > + > + return min_t(unsigned long, util, capacity_orig_of(cpu)); > +} > + -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.