Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp907132ybl; Thu, 23 Jan 2020 09:55:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyVK31GCKZ1o5iTEMQPdP7jS/qEehpsbOGo9BQuZxJa2RVdmq8WmAqCZUZFH39L6k/hR7Gb X-Received: by 2002:a9d:478:: with SMTP id 111mr12177570otc.359.1579802141876; Thu, 23 Jan 2020 09:55:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579802141; cv=none; d=google.com; s=arc-20160816; b=lidDbDldYyRx9d+Zt6Yh+5CmoxmzRICAccdFHuUn2WZGLBeF473iG6FwmuEfbf7KSL PqRsZZlm51s08RiSC3ikTz9bJ7w6tNVYF+ck5dRa3w8lYYcTPs48qJS4oxQ7Ypa+Gdwd lYLS04OHruPDH3esz5GIRsUxIp9Uo/RjY9tJkCuoUllhgS5nh32fCUVfswFjzgQ1nape 7wYDQ4cwJeMekhE0vsja2R8mVEzpRyrhHHxAO8IxFy8hoz+ZMEFlhUfDCnxPgucZ1Cp1 YPeOzlQYHdrD+gGDSk3KyOwm+uZsAwQOiQAwuz16mZL7+DCt+6BLubZ780op9FeBcSdz MQvQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=WeG27lIGqjRDt+DhoxtLIjIjkN0kBATuasLNsP/S2jk=; b=MLl8i0LQBRz2lqakl9bgoOcpj0aRSNb6iq4/aeLFvYb86Bcv13EzUjcZ32gpq0wRE1 kI5PGooYg93OAl2Hb91R1exIjmyh/ulNAfhST+/pdj6732bsjYUBP7Bme16sJE+aExWw zRJi96pTqmfwR84yrLiX6BlFL7x5x2Hc8MKnwm18O95nfBZ1Bzq4lfvAgcGMowvHBx8N zR53RotDaxcxrDyGgeKFWAFzCwTMcEN88WmMaecfAReKOiJ54SCkJXOZWnSGslpeLC0j UP2pGTQZed0h505vZRMHXLPSGdHJroNDm2x5xGHJxEPD9QqfA2lEIrhwtJRgKBrPnyGc k6wA== 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 f15si1101168oij.160.2020.01.23.09.55.29; Thu, 23 Jan 2020 09:55:41 -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; 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 S1728792AbgAWRw4 (ORCPT + 99 others); Thu, 23 Jan 2020 12:52:56 -0500 Received: from foss.arm.com ([217.140.110.172]:42864 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbgAWRw4 (ORCPT ); Thu, 23 Jan 2020 12:52:56 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 49B711FB; Thu, 23 Jan 2020 09:52:55 -0800 (PST) Received: from [10.1.195.43] (e107049-lin.cambridge.arm.com [10.1.195.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B0673F52E; Thu, 23 Jan 2020 09:52:54 -0800 (PST) Subject: Re: [RFC PATCH v4 3/6] sched/cpufreq: Hook em_pd_get_higher_power() into get_next_freq() To: Quentin Perret Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, linux-pm@vger.kernel.org References: <20200122173538.1142069-1-douglas.raillard@arm.com> <20200122173538.1142069-4-douglas.raillard@arm.com> <20200123161644.GA144523@google.com> From: Douglas Raillard Organization: ARM Message-ID: <5a2af4e7-f9eb-4f23-908a-fab2c7395a99@arm.com> Date: Thu, 23 Jan 2020 17:52:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200123161644.GA144523@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB-large Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/23/20 4:16 PM, Quentin Perret wrote: > On Wednesday 22 Jan 2020 at 17:35:35 (+0000), Douglas RAILLARD wrote: >> @@ -210,9 +211,16 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, >> struct cpufreq_policy *policy = sg_policy->policy; >> unsigned int freq = arch_scale_freq_invariant() ? >> policy->cpuinfo.max_freq : policy->cur; >> + struct em_perf_domain *pd = sugov_policy_get_pd(sg_policy); >> >> freq = map_util_freq(util, freq, max); >> >> + /* >> + * Try to get a higher frequency if one is available, given the extra >> + * power we are ready to spend. >> + */ >> + freq = em_pd_get_higher_freq(pd, freq, 0); > > I find it sad that the call just below to cpufreq_driver_resolve_freq() > and cpufreq_frequency_table_target() iterates the OPPs all over again. > It's especially a shame since most existing users of the EM stuff do > have a cpufreq frequency table. > > Have you looked at hooking this inside cpufreq_driver_resolve_freq() > instead ? If we have a well-formed EM available, the call to > cpufreq_frequency_table_target() feels redundant, so we might want to > skip it. We can't really move the call to em_pd_get_higher_freq() into cpufreq_driver_resolve_freq() since that's a schedutil-specific feature, and we would loose the !sg_policy->need_freq_update optimization. Maybe we can add a flag to cpufreq_driver_resolve_freq() that promises that the frequency is already a valid one. We have to be careful though, since a number of things can make that untrue: - em_pd_get_higher_freq() will return the passed freq verbatim if it's higher than the max freq, so em_pd_get_higher_freq() will have to set the flag itself in case that logic changes. - policy limits can change the value - future things could tinker with the freq and forget to reset the flag. If you think it's worth it I can make these changes. > Thoughts ? > > Quentin > Cheers, Douglas