Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp299570ybx; Wed, 6 Nov 2019 00:26:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxQvHLf4zMp30g1wUXrahk56oFMdoEWnw5TecFfPBDxmJFll2QdVRYM5s9fPLxhUtfpwn28 X-Received: by 2002:aa7:d147:: with SMTP id r7mr1303716edo.198.1573028772080; Wed, 06 Nov 2019 00:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573028772; cv=none; d=google.com; s=arc-20160816; b=hl3cBHpoGU7MOWmsRWeLsg5GyGQ2TF8yJ6zZAvTjuurPczWC9HUxZV59k2GTA25eTI H4RN3e1E2zppyOhgR+RQeGwKjxVT8t3vRtRtkbp+arN3YE/1x8+MHJEYrxyh3Q8GjlZ1 5xdYW34XIm6u3FOJeG5YksEjEmGPPyIHud5DgeC8BS+kKn3gWAaUz4yPB3tovTcF1Vvg z/yfYYkJIx+rweYO8IkSKhzkOn9yeUuoveO03V+pnTVb/ygMKZWDLQhSpJx3THKoDhzm YGay9CAcFjRf8fYY3bzm7S5wLYmxk4svX7nxh5++cgoEIDLIFO2grA5UerkFe1EdA2ua +rag== 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=AsOm6FtAmQ6Vl+H1p7N9YFJ++I/KjSyKvyrHPkvfmIA=; b=qxvc0IJjJxOWSFsR+vpGex9Mf3p0ZVvjIOrzAWZm44mj1KbEmCmLcU1Q+NlrimKIwh yJPOyrdjCW4tonGRPPe+0W3YT/vsdkoWdt8zBYu53dFkRl/5gtBxcUERY7mwNyKHdPi1 txnFuMaRe8d+v4YD5Zuvu4X1SpdyT9Cfo8Q+pOLK7bPQn5t8se/lZtKJ6pWadPVyliUA kMDxp4aL0B9Ip5rmbZEOWEmnMLQE+lXQ+TPevjxbDY4URzzU3tDlA4z+nAhdnx0K5fyH aJ7cw61il3ZkgNOrk1xbZ7MH7cSEprRmn0yUIM/ZSIi4BpakS79oQy5jkjMlGM9AXdte /qNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vEKMpbqJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si13539759edc.387.2019.11.06.00.25.47; Wed, 06 Nov 2019 00:26:12 -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=@linaro.org header.s=google header.b=vEKMpbqJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730139AbfKFIYs (ORCPT + 99 others); Wed, 6 Nov 2019 03:24:48 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:38677 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729951AbfKFIYs (ORCPT ); Wed, 6 Nov 2019 03:24:48 -0500 Received: by mail-lf1-f68.google.com with SMTP id q28so17365169lfa.5 for ; Wed, 06 Nov 2019 00:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AsOm6FtAmQ6Vl+H1p7N9YFJ++I/KjSyKvyrHPkvfmIA=; b=vEKMpbqJ9++hi5mE5ogUdGpiztGQeCFzAIQWesE2oYkw0SgVf3O0r+uo8C+7sLnZ/z Y8sU1XX/yOz32mxkUpaj+iUfCGBuQV5hlW76GoDH/LQ/0fMVIM2hhcK+5iSCYiPy6D+9 UcixInKzDXXYdBnqtkuOEkXhSqo9yytjM/2094Jwfd8o5NQdNsAVBj5U5ipHOs9BpF6R sp1GzVK2wKk+Sp0Qa/fXI/oqDr++v3/7KDKgpe9AKn3x79Qa5fQ6gONzEQY3wQ5WKcd4 3qcc8Ue9sYV05Akpqv2vJdLN8jxq2yT1lLq8aMy3+6djJHnL0C3/6jTqhw+7Dii9IanV uPSQ== 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=AsOm6FtAmQ6Vl+H1p7N9YFJ++I/KjSyKvyrHPkvfmIA=; b=Is22diWdfiASkl2++HdFtJ/mQ0kqy/gT2MECv7zeRCc83/911mM3HezCDiD8ZGPqU2 mvdHP3GUh37AZZcth7Ih7u4tcPyTOP18HlTQq0EJWJf1gwZcjFfjcc4ZLGVmkVRjPboq 86wuGCe5q8Mrb6Hw1FKFoCE94yO8rPFo2rqc0TusVXlIlddQk8LmEj18YDnTgw9JG/Zn q0D5snWh6vCgG5SrsZVBRbU8inWoAcXdtflqPxyMYKs+FjZEuBBuQe578hyazujfRc/r 4z6wYnsw/2obTdxrNqVSdB1nQg5q7qUB5An+T5Gu4AsVDNNSLFj7YS+wxeeh0nVKRXPn zQGA== X-Gm-Message-State: APjAAAXRYq+yYWBIV3yCphR+9sIcU7SP3IdHvYM7zuCvFKd88TfHAtlb 1CTOr1o2HhIKy4lBK+5gjTMkJqJyoVj/FbJjcmpR1Q== X-Received: by 2002:ac2:5dc1:: with SMTP id x1mr23012889lfq.177.1573028686091; Wed, 06 Nov 2019 00:24:46 -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: Vincent Guittot Date: Wed, 6 Nov 2019 09:24:34 +0100 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 , Zhang Rui , Eduardo Valentin , Quentin Perret , linux-kernel , Amit 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 Tue, 5 Nov 2019 at 19: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 Reviewed-by: Vincent Guittot > --- > 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; > u64 idle_stamp; > u64 avg_idle; > > -- > 2.1.4 >