Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1203147ybx; Thu, 7 Nov 2019 08:41:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx1TD0rJDZJ8phBTYqjjX/6Ted9ypbPLUjrg+j5utXHkCbsW3GT1YYY2SjjgIrdEwTPL2Cj X-Received: by 2002:a17:906:79c9:: with SMTP id m9mr3806277ejo.297.1573144890876; Thu, 07 Nov 2019 08:41:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573144890; cv=none; d=google.com; s=arc-20160816; b=Sebheb8i46kwvSGLghpWFzKixdzDpeO7enuIEZtoSWJLoXNVBBMrGom9k4L9zAd6Ve +6c2fCxin6qGQMb/rTTW/xu+mn17zuvCP3khQvJRgu04HBT/vH3xxjyLawiDSoe+dR49 RvIxEvG3AmKWqcUxUI1JpoVgB/wb58T3H7RjXiHU42gldJgAhp/PJPQwnI5H0nzzKonw qo2vJvQa3PIVMrOWFBUhKPFG7F4Lx2NylrpD25iJyM9mJg54vwvDX81bOjguK6hn3KDk 035PI3XD2oEFK4uKLwGQKWwyP3nZ6yBzpFDIvxtJypgCfsCNykGtF/Sh8p4omdYveq/d 7RxA== 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; bh=p5sdp9iSCUcXNwQ3Gh3HHVGO3/wQCq+0Ac0qqhez3To=; b=bq7WMuq1/fWTjziQ/lPPXwEaxddPK8zw3eQakBo6HVcmnUzKlquKoPXMA7BfBDaGTF ctdQgLpivBrwEhaPx5pPb5d93gCV4hXS+/X4Wh30qWUZGckNzZH87hk1ZXcElRrF4enI tkzqvH9wZbqtaNzrMVpTSGVwfj0NxF39VaMAFkjJBb5h72y7Ug0dlJx5RQhYVinUNQHw +wLVrdN/iKPimNvqWW3A/urHQowXqE+EbeV6k7mBx9dxf6yw6gPxT2QvSUCMHb+BIk8p Cg+HNoOA26D7OGevyDS89nU+6uOtj6iIzLXhiHw/9lyCLyQ5lWceQNZeJNwhn9cG2OhI 0zxQ== 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 g40si1927713edb.369.2019.11.07.08.41.07; Thu, 07 Nov 2019 08:41:30 -0800 (PST) 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 S1730618AbfKGQjt (ORCPT + 99 others); Thu, 7 Nov 2019 11:39:49 -0500 Received: from foss.arm.com ([217.140.110.172]:58956 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbfKGQjt (ORCPT ); Thu, 7 Nov 2019 11:39:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 14B1830E; Thu, 7 Nov 2019 08:39:48 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7DC7A3F71A; Thu, 7 Nov 2019 08:39:46 -0800 (PST) Date: Thu, 7 Nov 2019 16:39:44 +0000 From: Qais Yousef To: Thara Gopinath Cc: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, rui.zhang@intel.com, edubezval@gmail.com, qperret@google.com, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, daniel.lezcano@linaro.org Subject: Re: [Patch v5 1/6] sched/pelt.c: Add support to track thermal pressure Message-ID: <20191107163942.74bfnsabh4dyvlo5@e107158-lin.cambridge.arm.com> References: <1572979786-20361-1-git-send-email-thara.gopinath@linaro.org> <1572979786-20361-2-git-send-email-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1572979786-20361-2-git-send-email-thara.gopinath@linaro.org> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thara On 11/05/19 13:49, Thara Gopinath wrote: > Extrapolating on the exisiting framework to track rt/dl utilization using > pelt signals, add a similar mechanism to track thermal pressure. The > difference here from rt/dl utilization tracking is that, instead of > tracking time spent by a cpu running a rt/dl task through util_avg, > the average thermal pressure is tracked through load_avg. This is > because thermal pressure signal is weighted "delta" capacity > and is not binary(util_avg is binary). "delta capacity" here > means delta between the actual capacity of a cpu and the decreased > capacity a cpu due to a thermal event. > In order to track average thermal pressure, a new sched_avg variable > avg_thermal is introduced. Function update_thermal_load_avg can be called > to do the periodic bookeeping (accumulate, decay and average) > of the thermal pressure. > > Signed-off-by: Thara Gopinath > --- > kernel/sched/pelt.c | 13 +++++++++++++ > kernel/sched/pelt.h | 7 +++++++ > kernel/sched/sched.h | 1 + > 3 files changed, 21 insertions(+) > > diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c > index a96db50..3821069 100644 > --- a/kernel/sched/pelt.c > +++ b/kernel/sched/pelt.c > @@ -353,6 +353,19 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running) > return 0; > } > > +int update_thermal_load_avg(u64 now, struct rq *rq, u64 capacity) > +{ > + if (___update_load_sum(now, &rq->avg_thermal, > + capacity, > + capacity, > + capacity)) { > + ___update_load_avg(&rq->avg_thermal, 1, 1); > + return 1; > + } > + > + return 0; > +} Care to add a tracepoint to this new signal like we now have for the other ones? Thanks -- Qais Yousef > + > #ifdef CONFIG_HAVE_SCHED_AVG_IRQ > /* > * irq: > diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h > index afff644..c74226d 100644 > --- a/kernel/sched/pelt.h > +++ b/kernel/sched/pelt.h > @@ -6,6 +6,7 @@ int __update_load_avg_se(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se > int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cfs_rq); > int update_rt_rq_load_avg(u64 now, struct rq *rq, int running); > int update_dl_rq_load_avg(u64 now, struct rq *rq, int running); > +int update_thermal_load_avg(u64 now, struct rq *rq, u64 capacity); > > #ifdef CONFIG_HAVE_SCHED_AVG_IRQ > int update_irq_load_avg(struct rq *rq, u64 running); > @@ -159,6 +160,12 @@ update_dl_rq_load_avg(u64 now, struct rq *rq, int running) > } > > static inline int > +update_thermal_load_avg(u64 now, struct rq *rq, u64 capacity) > +{ > + return 0; > +} > + > +static inline int > update_irq_load_avg(struct rq *rq, u64 running) > { > return 0; > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 0db2c1b..d5d82c8 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -944,6 +944,7 @@ struct rq { > #ifdef CONFIG_HAVE_SCHED_AVG_IRQ > struct sched_avg avg_irq; > #endif > + struct sched_avg avg_thermal; > u64 idle_stamp; > u64 avg_idle; > > -- > 2.1.4 >