Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp377331ybc; Tue, 19 Nov 2019 02:54:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwqNvgUYq2a0q8xyofOn6ajSN6+c9e8Ics+4HLG6qljAx/uFugJyucGibMPGp1HORMdVrAR X-Received: by 2002:a17:906:ecb8:: with SMTP id qh24mr32670071ejb.174.1574160895110; Tue, 19 Nov 2019 02:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574160895; cv=none; d=google.com; s=arc-20160816; b=Fk+GsEsf9NaPrB2g3rqHWVWUEf/FX2CqemLnNGMxgRjfcIy3ZkHAq/uI5ZHDfxZ1Ac tbEk2bCIW6FOJSrzU6jxXaPWgb0sr5CtqAc43aKMqFTknraywAFzaGRC7vSQyxxHNP/V SOzFDAF8tNI9VHykX3707Ec0EQ48XLLC6yoIZYEj5h7p1zAgYUz1/koTSZj3KPvVli6H 6whgugrvUENZ0YOZERNevEoIOsnU5pyCKdbWSB5ZCxewuFjuyZi6ZZr2RAZ0Tcv5iPzj ljT45NWOFcQy4TKlKzUjhE0t4R3Ceiz8I2jvGP9HV31Le+YW5zDcPKgojdWtc9M1iDDX RevQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5xtsF1Sv+l+9zrpE4z0KioV1mHpXZsbvecSOZbkb/Q8=; b=j69pfRhpNhxzSsGEo6Zsc84HWZkeVtwBTrgV0azoG5m4xJedO/woOMXI91a6zGb14S Av+Rj4kly+ntVU5fy+M38hTga0OECzzSwdWsae8nohlWvVSIFhrkjiyDeKDHV+KGJC5F fqvR3/HIcE50TBqMHtKpURLaLxqigwyXBIL2lTJw3HwUS5LHaMhJG33QnomONQQ5M8DD mDVUpB33p37R/zD3HhHU0Xk9p6uBFqXWX3C/XWF4xvFFVQUEhtHdiEalxpNENfsZbiuT HSRVN5gO6Njc+7o1Jdmws2ylv4n8Jp5ulw4axnYjQtHXc6K7rT80M5lIxjUROpYlNlFZ isQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=hq9IXkC5; 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 y24si13309206ejc.170.2019.11.19.02.54.30; Tue, 19 Nov 2019 02:54:55 -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; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=hq9IXkC5; 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 S1727627AbfKSKvM (ORCPT + 99 others); Tue, 19 Nov 2019 05:51:12 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:44865 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfKSKvM (ORCPT ); Tue, 19 Nov 2019 05:51:12 -0500 Received: by mail-vs1-f66.google.com with SMTP id j85so13859613vsd.11 for ; Tue, 19 Nov 2019 02:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5xtsF1Sv+l+9zrpE4z0KioV1mHpXZsbvecSOZbkb/Q8=; b=hq9IXkC5JKzFG1aE2B51COqqquq5bFvThTVH4Gj/fldrzI5Ih6wXfn8pRZtOIvDcHK TRmglLfHOF89Yqcd16P05oO2z3Mdqk5uq7Qg11ljMwZjl2b/RmJjIfD2jaeAl1sooMRx lbHE39wwvW4fQxrzcA5mvM2tv3VmDvWqxYWp45B+g0+B5lfPIau2Mo5JUKISVZ2RLRpH VPMcP9Y19RjKPtx8vC2M2dxJQsNerXAKWZPfhnekCyVD3gS+RXpmqV07yAKmRnyjOqio w71saYZE26s3KxvG8TI3xUBpK4mVz11A2rzF2ADEr8SOYxKEpurX27BOx+LXK3yWHKqb CwCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5xtsF1Sv+l+9zrpE4z0KioV1mHpXZsbvecSOZbkb/Q8=; b=YjNRoHVN7uLlEDU+cU7CCMm/8Aq21xQJqbnakaEht4vl4EI2hE2DNJxkbYTB+J+GR3 eY9XOmhaD0YNDPvtqmRxrlwrzDiHU9ft/w7biG87uihIEH0XoDNb6c3u0vgRoMthRdcM XtLtmMl4YvE3syesTRZg2aXZlTvQTA2Yi8YNmE7iUZOqcmweREwpKEaVUPdPNT25Xtd4 KWtujx+V784SFMMXP1Rj9OsPoW+oioi9rwX08KSQKy31TqsIAfYPyfqL4PYA/Db97EJw NqUqHW56VlrFJDmYhatLp3sdZM3rrcJiM4A/LREw+b+ayFhhyrtxU8VtBFOaCOPs4cBH CX8A== X-Gm-Message-State: APjAAAXuWusJWTjsYAdqF+E2JxCLZ86sN0g5utKrky9c6/4PZ1WhRyCV uhk0zN0nl7IJw3k6XRDWn87svAfUEAZrrlxdF3WbsHYs X-Received: by 2002:a67:da85:: with SMTP id w5mr22162061vsj.159.1574160669891; Tue, 19 Nov 2019 02:51:09 -0800 (PST) MIME-Version: 1.0 References: <1572979786-20361-1-git-send-email-thara.gopinath@linaro.org> <1572979786-20361-2-git-send-email-thara.gopinath@linaro.org> In-Reply-To: <1572979786-20361-2-git-send-email-thara.gopinath@linaro.org> From: Amit Kucheria Date: Tue, 19 Nov 2019 16:20:58 +0530 Message-ID: Subject: Re: [Patch v5 1/6] sched/pelt.c: Add support to track thermal pressure To: Thara Gopinath Cc: Ingo Molnar , Peter Zijlstra , ionela.voinescu@arm.com, Vincent Guittot , Zhang Rui , Eduardo Valentin , qperret@google.com, LKML , Amit Daniel Kachhap , Javi Merino , Daniel Lezcano Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 6, 2019 at 12:20 AM 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. Use a blank line here. And reflow the paragraph text. > 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; > +} > + > #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; Have your considered putting this inside a #ifdef CONFIG_HAVE_SCHED_THERMAL_PRESSURE? > u64 idle_stamp; > u64 avg_idle; > > -- > 2.1.4 >