From patchwork Tue Apr 16 19:38:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 162353 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4616080jan; Tue, 16 Apr 2019 12:38:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx6npVFVx462ivlR+w/xoas6URtRdHBAN6/TQh6zR0mBW6WJUSwwBeDeV8PAknGEZXIod2 X-Received: by 2002:a17:902:b40a:: with SMTP id x10mr84617431plr.231.1555443538863; Tue, 16 Apr 2019 12:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555443538; cv=none; d=google.com; s=arc-20160816; b=SX2GqCRBohzjQzIGkvq5u1d4pl9V8NOnUajWtfQqu2R6/JrEBaXoSZCUrN/PpUsCyh B5IO4d/Vm7NzIVBtjZUPubeAQm4BKMiZ4BKltJ2/u9oMkNVU1dbOT18YLZVsu3RDNYJL TWXULGMxUIgrN22byc1HqSdajRvuRv95bVemj41Lh6Pvmlq50Dbi+q0NjBkgZ7EBl4Xz aTMsNJz7C8DoYF6dDmQ/fALWc3nVcLuv14CKuFaBfjV/iGeJqKqSY1FIJFgacbdDy8HX 5xNLlZ6v/ErEjBz0CuM3/5jxwcxXjEFbDKURsjtg+Wc18PCG0z2iZHEW18pQHDNjJ9vC rtoA== 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=KNbekIfBRRm8uM1KdnvYGnhJo7PPeihMU4LxOw05fOc=; b=G3huIFQMHqird7GscGbsfhoKB6RAEmbdxOeH+WUckMNmQNXCXzXhnMGakGR/MBlORj JsTnop8hWCKth/EER6+ssvXzr4A7Y7qKHyXLwFbvmHfyjWaRYPk7MGyvrAFv5pMVIrLB VCgBM2Wmza7/uhkuNgif2ye8FWGlKKIUD53scFsXsxktMj+EKYTbef23O/Ye8icm1BPs K0cY771jZ2AshQUeUEXLP9cD4QzXrJY2KofseAHn/TbC9h6Mg7CF4O6gD1+7LmcOXy9s kdddDsqH2AIlaUYT3pTuWir9xIZcBwWiXB09EPzd6fgFpER4zNfbS2WO9qO2ow5eVXUo RMAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dPULVRJj; 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 a1si49035478pff.258.2019.04.16.12.38.58; Tue, 16 Apr 2019 12:38:58 -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=@linaro.org header.s=google header.b=dPULVRJj; 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 S1730301AbfDPTi4 (ORCPT + 30 others); Tue, 16 Apr 2019 15:38:56 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36414 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729785AbfDPTit (ORCPT ); Tue, 16 Apr 2019 15:38:49 -0400 Received: by mail-qt1-f195.google.com with SMTP id s15so24745855qtn.3 for ; Tue, 16 Apr 2019 12:38:48 -0700 (PDT) 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=KNbekIfBRRm8uM1KdnvYGnhJo7PPeihMU4LxOw05fOc=; b=dPULVRJjB3vqxeNVjKurm9q6bgO2XVeQgLiDeXQptGe8f2megTmgP6kpFst3QBJfZW W5bGXDdhGFOMqMwcD8oiGUCOofULwc5Q43oCKAfUdUZXkG2VgW8efkNuJR2fsOzJZpbX 4UR0+IMSYJFc1S6HkZIrhiQXW+6Od/uwjGdhoJFdOjvkUoakOPX8Dk9QiDnhDiqtkFzB bcFEHaYNs+swYiwsToSJh3pNQc/C9icY3uLvZpz1ozTB0TvZZ1ViMYqHLq4Uy5CoaFSg hsYUAbEIOXkWmXLPusFcxBldxHFkWLAoEuIcVT43pUvTsr07s5LmvZutt8TOW874to1S k6+Q== 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=KNbekIfBRRm8uM1KdnvYGnhJo7PPeihMU4LxOw05fOc=; b=WBdrdeCZqHi088S2x7WH3/HNf7tmr3r/GANdUcJUj5xDKUFoFOpSKxzUZWic+tEVLt +t8J8FN3Dnrkb4LYkyTIdMlCJ7hcGIUC49435Y7bRUFUYBUbz/YiTA1/OLbsNrdngek1 27qsH1BefVxTAje4HTFAp5qk5Z1+wyEzibNdDs2P8kEN21SjaymnZwWVAxB3uu/LbIZb 6NnoRM6KSCEvTnG980U5bZtD8hitIY4lFmYMHYUEFT6+AvIECwn3bQS5Jz1mACC5vzl3 /oCw0qHWUA0NbkL4PEBMciagHWE6wkjhkRGaCjDhcU4Mt+XeAqbgyNtqxbaMP3X9miyU A2Kg== X-Gm-Message-State: APjAAAUJB51+ZpPXM7Kevlw1SatEmYibNVfYnkIUg6nnWbagqf+GYep8 StsNbLSP4i2kSNTJQ8NitT6wag== X-Received: by 2002:a0c:d2f2:: with SMTP id x47mr64643661qvh.90.1555443527688; Tue, 16 Apr 2019 12:38:47 -0700 (PDT) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-245-97.washdc.fios.verizon.net. [71.255.245.97]) by smtp.googlemail.com with ESMTPSA id k41sm46150797qtc.89.2019.04.16.12.38.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Apr 2019 12:38:47 -0700 (PDT) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, rui.zhang@intel.com Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, viresh.kumar@linaro.org, javi.merino@kernel.org, edubezval@gmail.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, nicolas.dechesne@linaro.org, bjorn.andersson@linaro.org, dietmar.eggemann@arm.com Subject: [PATCH V2 2/3] sched/fair: update cpu_capcity to reflect thermal pressure Date: Tue, 16 Apr 2019 15:38:40 -0400 Message-Id: <1555443521-579-3-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555443521-579-1-git-send-email-thara.gopinath@linaro.org> References: <1555443521-579-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 | 4 ++++ 1 file changed, 4 insertions(+) -- 2.1.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8213ff6..c5454d3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -23,6 +23,7 @@ #include "sched.h" #include +#include /* * Targeted preemption latency for CPU-bound tasks: @@ -7967,6 +7968,9 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu) if (!capacity) capacity = 1; + capacity *= sched_get_thermal_pressure(cpu); + capacity >>= SCHED_CAPACITY_SHIFT; + cpu_rq(cpu)->cpu_capacity = capacity; sdg->sgc->capacity = capacity; sdg->sgc->min_capacity = capacity;