Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp400285yba; Thu, 18 Apr 2019 03:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWBxRwBhWGXyaubRc0/77PHb306HY2KuqsX+r2IRwbXXh5F8q87/g3JanTgW0kt/4ceY2p X-Received: by 2002:a62:ed05:: with SMTP id u5mr68564848pfh.63.1555582612283; Thu, 18 Apr 2019 03:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555582612; cv=none; d=google.com; s=arc-20160816; b=OZgRNnKY6znHcrUYej+sLaQmV6uF8qhtv03R/yactxTeJTUlNtCbQSkjAB/T9TdPii ggduMmabqDEFH+zBx4PxDj4zdaZSYyVCfbjIfX1Y0sHN/NeN9Gwf/HqepQ9K/RIgdVzq 8U3kJMugv5v86LxrWjvFMaYdKRFJzTwIqBkiC7u+6Uztb1h7TBK/5x/lGVQMiQZr/Eyo VSG+yMVUROfQmbTafH2mz5LPbf27VFShQwDkcoSAktS20psNKsCm1xxDpHHoLI1Yw8p0 v+4LmtprEvTAHc1gDZeMyz6YUFOvKTcuvrPBrbdu+oZsmYUS5D9/oRhqfKMleMdawDKf g7FA== 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=P8lyS1qJAur3NuvIyCbDe9iPIQAommggnXTFGamxjMc=; b=gIWGP1D12iiwP0ZkHS22qLt2d8OlA7MHrwRzc3OK5CG0rmqHBvdS4tS1GRM5mnsey+ xM1iSb6RBPngg+NuXb+L4oxEzz0xMapqkjJMz9N+IBTAcAUTkCEpsF/o8qlbuMkfk4c6 c4E9TxzN0x+hBlgVhLueEorwND/lqyNmY7TS5evy6EivK34kj00yOmisJKqyIY/tixdA B8OzZv3dtRcHTC+WUPgitM0kfi3DVH8cNl1dDR/pW9wtLckWuuZflX5b2Ky/wJaK7xzo 028U9m5qocsBA+/bTQUvrof5utXwvR8fLf4AaxEc7+EkLUitZUsomcFWdBp762Te2FFw NMmg== 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 n11si1496762pgu.562.2019.04.18.03.16.36; Thu, 18 Apr 2019 03:16:52 -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; 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 S2388401AbfDRKOZ (ORCPT + 99 others); Thu, 18 Apr 2019 06:14:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58936 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbfDRKOZ (ORCPT ); Thu, 18 Apr 2019 06:14:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 656EB15AB; Thu, 18 Apr 2019 03:14:24 -0700 (PDT) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F20E53F59C; Thu, 18 Apr 2019 03:14:21 -0700 (PDT) Date: Thu, 18 Apr 2019 11:14:20 +0100 From: Quentin Perret To: Thara Gopinath Cc: mingo@redhat.com, peterz@infradead.org, rui.zhang@intel.com, 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: Re: [PATCH V2 1/3] Calculate Thermal Pressure Message-ID: <20190418101418.5kiw5hkxoflbsvlj@queper01-lin> References: <1555443521-579-1-git-send-email-thara.gopinath@linaro.org> <1555443521-579-2-git-send-email-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1555443521-579-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 On Tuesday 16 Apr 2019 at 15:38:39 (-0400), Thara Gopinath wrote: > +/** > + * Function to update thermal pressure from cooling device > + * or any framework responsible for capping cpu maximum > + * capacity. > + */ > +void sched_update_thermal_pressure(struct cpumask *cpus, > + unsigned long cap_max_freq, > + unsigned long max_freq) > +{ > + int cpu; > + unsigned long flags = 0; > + struct thermal_pressure *cpu_thermal; > + > + for_each_cpu(cpu, cpus) { Is it actually required to do this for each CPU ? You could calculate the whole thing once for the first CPU, and apply the result to all CPUs in the policy no ? All CPUs in a policy are capped and uncapped synchronously. > + cpu_thermal = per_cpu(thermal_pressure_cpu, cpu); > + if (!cpu_thermal) > + return; > + spin_lock_irqsave(&cpu_thermal->lock, flags); > + thermal_pressure_update(cpu_thermal, cap_max_freq, max_freq, 1); > + } > +}