Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp132619yba; Tue, 23 Apr 2019 21:14:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlsc1lZH8ScP+PxGKlSL20/hzgtVsIZcXUgRyMlvX8/9P/xIZgzk80hUe3xj0QI4dn7Clw X-Received: by 2002:a63:c505:: with SMTP id f5mr27774790pgd.87.1556079291871; Tue, 23 Apr 2019 21:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556079291; cv=none; d=google.com; s=arc-20160816; b=T6TLptiXZvv+m6QTWiRwKaYhuENtJ2SNxY+27peZcblpL/tuccUIgvaRfe49qZi+gt wbtC+LSkLEN9QLLiKOVoOj/rTNZQDyAvemehJ/bAWC55R/588zcv0jeUjNjjDYJOns4G rkzUUKxe5QKXt2zDbD0ckImEZCc2GRamDKP6TOM5tERMCLzcfPuCaXvh9OoacAcvuGJD 0/0EdR9zWPVdvVfb0ZLycKDCl6TJHiOxx/5WG8jn8AiKNScCymJjn2pUj72E8lM9/om5 5BsjHoYqpehVIs2iNZWn+SqF14tjQwmpi8MtkvTogV7JQpYQQxgIBJPo3iUmuKQwMICY mttg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=gn7rK0B9/eSlSI85DtD0W9jgqm3yeCYqZOhHbw08jS4=; b=GwXnfhCb/Uw4RkF1br6BazUh6LD7WnA5xIoKzxL38AC524LJK+MiBGTmdlNy5dpNqL DzmSdHs2N0g4s0N2cMGMzFpHKnP5gz6/ZTjp6XI1GQ/+fmoVESGDVlA3rKdAQZUBnG7t rvic2TgJ4HH1lAR0T66W0JiCRFr3ojmt9eIbN9vXqXaZY9EEJWgBdWeTWd3NyrGEitQB g5fbExxLy5qNsSPrYRbYnABTPO9o66ouY92x905GUrboLffJQQgl9bsQ/InwPYiRQCbE E7++Xf5dDkl0JpH2EO8LiAcyoW3T9TPYT4RElvBHN7D3HpJP0yBT7dTrkA+B2dqwTDvi Qhfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fiWOjvLl; 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 x1si2473293pgg.478.2019.04.23.21.14.36; Tue, 23 Apr 2019 21:14:51 -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=fiWOjvLl; 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 S1726458AbfDXENn (ORCPT + 99 others); Wed, 24 Apr 2019 00:13:43 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:44517 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbfDXENm (ORCPT ); Wed, 24 Apr 2019 00:13:42 -0400 Received: by mail-qk1-f195.google.com with SMTP id y5so10016617qkc.11 for ; Tue, 23 Apr 2019 21:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=gn7rK0B9/eSlSI85DtD0W9jgqm3yeCYqZOhHbw08jS4=; b=fiWOjvLlZOm7gIlf8ejA2rc9r71SLsXuQjK9maF8VGnBgebFo/XytEKm5B3UT3mEFO 6jDMJ6SLPvc4HKZ5x69/11mi9IquNfd6I5c6NS+9S72q31JwEbO7qRJaAf7D95WWsnOH mkdTthy5YxsU0LoBnTpImL+jMPHAb+qWHw5atN/x+QK5dcQhRYvXJzGciS7wu+PO58ur E0rrNvbVSJEILAvZ1jK+w/l5ArYHI2OxpJfo9FhFj3q7cFRbu2ylGA9rSqgA/9FyaIpf 6DA5zifwQ1m+5TE8ESoMQW/AodjrCs7gE+50b3V5lCihc2KTh2osZF1vl05rS4GzgUki Hi9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=gn7rK0B9/eSlSI85DtD0W9jgqm3yeCYqZOhHbw08jS4=; b=ueXlWsb0jjbbJM3dmleVvLoxdeh7v3l0DxJmbLlRLh/sKNOJGg+G0BJGGvyYprYSki L6pe28sUZ9kPtlr6gmlRBxRtdCuqO3qxOEffterp95VvbxU5HQtrRc01yk59QdWIsglo S8v4lFMRRFAibOg2v/Ip0inQUjSrb37HWN8e46n8Y2OzRf+FBw1XygORsa/FD1zSqaSc 6WbZDDWkAkGsFSuFTUNQnMMfmI+0nw92xoo/QUAjaMLL2YoVbW/D83o8/lPBRPebc/Fi Y0TCcy7SuPsedd4A20+LXaTch8dJzUYDQh0KY0lRRV6Z6OiBkcT/7OXyvaTdj3pICks1 qe2Q== X-Gm-Message-State: APjAAAU1hrNW27BHkUinnVYyQwlnqHsabTYJtukLQf4+Q5UgKA/stEux Zf+knhKfMwuTW/BDeLRZPsR5vA== X-Received: by 2002:a05:620a:148d:: with SMTP id w13mr22700134qkj.6.1556079221738; Tue, 23 Apr 2019 21:13:41 -0700 (PDT) Received: from [192.168.1.169] (pool-71-255-245-97.washdc.fios.verizon.net. [71.255.245.97]) by smtp.gmail.com with ESMTPSA id 50sm5955692qtn.73.2019.04.23.21.13.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2019 21:13:41 -0700 (PDT) Subject: Re: [PATCH V2 1/3] Calculate Thermal Pressure To: Quentin Perret References: <1555443521-579-1-git-send-email-thara.gopinath@linaro.org> <1555443521-579-2-git-send-email-thara.gopinath@linaro.org> <20190418101418.5kiw5hkxoflbsvlj@queper01-lin> 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 From: Thara Gopinath Message-ID: <5CBFE274.8010103@linaro.org> Date: Wed, 24 Apr 2019 00:13:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20190418101418.5kiw5hkxoflbsvlj@queper01-lin> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/18/2019 06:14 AM, Quentin Perret wrote: > 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. Hmm. You are right that all cpus in a policy are capped and uncapped synchronously from the thermal framework point of view. But the thermal pressure decay can happen at different times for each cpu and hence the update has to be done on a per cpu basis(especially to keep track of other age and other variables in the averaging and accumulating algorithm). It can be separated out but I think it will just make the solution more complicated. > >> + 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); >> + } >> +} -- Regards Thara