From patchwork Thu Dec 12 04:11:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 181431 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp393845ile; Wed, 11 Dec 2019 20:12:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzRwYK+h6ePr3L3KcLWOYLAsLCTSFnXFMDE0vwEyF+OZhUE407748Ctb6FOIkz4rko6okzs X-Received: by 2002:a05:6830:14d3:: with SMTP id t19mr6080168otq.278.1576123925744; Wed, 11 Dec 2019 20:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576123925; cv=none; d=google.com; s=arc-20160816; b=dDxJdCzSMzIfzzMbTUQ5HRynMkgH+bnEvJUXsTIdKbE1hkVS7SbWpLCjzwaPd/gBgD 1ipgyAxXs5MUCchVERfa+ojz8qdNbB7v3y+XOuYUIACM2D2Un0R3m5eCgjSKDDIQ0vhO OQWc6tyr4XqcQyNAHWpU5l638KcncWWZX2dQhvA6mj5yNX4Sra8rAhVqYNbPidCVpy5A ArGUyHBq++7SxR6XQhC4z3EfSF5ps7L8c1b/pFflwhpOPkp2a+RK9BGOlcr36IAHziFe gndQXi6CDLYwrnmidQ8w9fWodvr4xbsR21K7h436kIzudiHraAWc4DuEKoreD4CtdZar 2gWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tCcvIBy4MWkmlTDlVDEp03XcYYwKUTHVbYQuzgTBX4Q=; b=FNC5A2P+BGFCSzOc8thb4iPZMbUR4Z3lNpZOqD6x9ZTwoy6n3gG0xkZkKXqJshc7Yv bhRh6HS8yCszeDvGrHuImoALpI3Y7nIptUxHK/c5jjSS8PhEju2MGKKlZXGC2qmV7Y+o o1hySjgQAs8ji7InX4ayaYRpkzN++rRwta9Tol4nGKtSa0Sptr+HWDgxTTRwtR3i8b2l Jb+YFkCDKsn4/sZ0u7+UANWtQe+iFSq2JcFIjgCYBiIMyG7QvjPOwdrqrcmeMFb8ozUF p9xn13rTNXVl/AcJXrESZPxj4KDPk9GylX75KUp2dqANrO0qF/LFwtrqKh/rYF6VnJwa hrDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ygf5rZfK; 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 x137si2385764oif.42.2019.12.11.20.12.05; Wed, 11 Dec 2019 20:12:05 -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=Ygf5rZfK; 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 S1727957AbfLLEMD (ORCPT + 27 others); Wed, 11 Dec 2019 23:12:03 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:44410 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbfLLEL6 (ORCPT ); Wed, 11 Dec 2019 23:11:58 -0500 Received: by mail-qk1-f193.google.com with SMTP id w127so505950qkb.11 for ; Wed, 11 Dec 2019 20:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tCcvIBy4MWkmlTDlVDEp03XcYYwKUTHVbYQuzgTBX4Q=; b=Ygf5rZfKVmn/YQ2uNC2loIbKbXNMF6frWitGn6qeyZ917m19A5o1WHD6CnSKJhwXVt 8vJSDHkWzbBLzSUKqGeWG/6Aj2oHGDxefkxkXVkehkoVlB450eAHBTvOpea/2kPVy+GZ DYZ/+YzXpJ9dkZrto/jov76v5xlJmHVFq3V8gL4JEmDItuwGbp6ciUpPbEYmKv5ClIEW VZxIaaIMoGHDL3ggjAp8iBjSDL1voIUDTrRtLWBZltJja++P/tdMancPKhXQuvsrmZNK bVKm6TGcLsB+E0qVJPb6q48wLx3VFmMq3ymvTXwDvSp6Upz7caAfnpiWP/pJgoCsxZG6 MXiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tCcvIBy4MWkmlTDlVDEp03XcYYwKUTHVbYQuzgTBX4Q=; b=GtrLTIj26qxOV0duR5HXYtZiKQJu9tqWit6tZoo4guzOxafzmRRW5/Dkg37Oe3gjIF pCzpcPoOfYfk/jWpDbyhOeQkADHmFhS9oMcw8/HcJCoxGp9/hr9VsjmmWVrhqi3zywyr jPMTjIggvN0h+H/R2DRySTKVMJ4ZClqGXwr+dQQyerAi43WmjpTloNhYA2eiWwZboGdM scJEMZ8A10Z4TWL2bNmTS1wEbdwe2N59sQ+ufPUJGRylbWtsm1LETZzvYxnZ7fSGBARO hlvaomVSVi6O/rQ3GlZ/scS9qEZKIkjBM0uIriyBmIJOBAFrUevVJg3JSsdj9zoCwv8A Nyzw== X-Gm-Message-State: APjAAAV+J0btvFecqzLB9Unqk7nT0P+CWbRZrDJ3+vlPO7GOdXakvChl IlUXjcMEFE/IsS7bk519nkalp0hjmnA= X-Received: by 2002:a37:5d0:: with SMTP id 199mr6226995qkf.131.1576123917716; Wed, 11 Dec 2019 20:11:57 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id s11sm1364126qkg.99.2019.12.11.20.11.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Dec 2019 20:11:56 -0800 (PST) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, rui.zhang@intel.com, qperret@google.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, amit.kucheria@verdurent.com Subject: [Patch v6 5/7] sched/fair: update cpu_capacity to reflect thermal pressure Date: Wed, 11 Dec 2019 23:11:46 -0500 Message-Id: <1576123908-12105-6-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1576123908-12105-1-git-send-email-thara.gopinath@linaro.org> References: <1576123908-12105-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cpu_capacity relflects the maximum available capacity of a cpu. Thermal pressure on a cpu means this maximum available capacity is reduced. This patch reduces the average thermal pressure for a cpu from its maximum available capacity so that cpu_capacity reflects the actual available capacity. Signed-off-by: Thara Gopinath --- kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.1.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e12a375..4840655 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7725,8 +7725,15 @@ static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu) if (unlikely(irq >= max)) return 1; + /* + * avg_rt.util avg and avg_dl.util track binary signals + * (running and not running) with weights 0 and 1024 respectively. + * avg_thermal.load_avg tracks thermal pressure and the weighted + * average uses the actual delta max capacity. + */ used = READ_ONCE(rq->avg_rt.util_avg); used += READ_ONCE(rq->avg_dl.util_avg); + used += READ_ONCE(rq->avg_thermal.load_avg); if (unlikely(used >= max)) return 1;