Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp832055pxb; Thu, 15 Apr 2021 07:38:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+WOwbfhlR9vrHPDLpUESwn1rjj0PZP9EFz6/4bk9MokPQGAQxNYFcT4CB5VzYeCUroIth X-Received: by 2002:a05:6402:51d0:: with SMTP id r16mr1302904edd.52.1618497531697; Thu, 15 Apr 2021 07:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618497531; cv=none; d=google.com; s=arc-20160816; b=O2AK4KBp8B+5QkXBun9LeiBSNNXnqBt+mP/l8yX75pzRGl3RCjeVkKGFas/UJ7negP N5qDOaAM13I5jCymyoaTov6zd9nCWdvn7hdWyG9Xk6ZC1MsDH9M7IaJGx2JDxMA2Oy87 qBEAycbDk7s86EIHAoxAsy/KZBWpWaORkR9Ox9t7gp2TqmAHtA/ibXWAzVyD9mbjDodk hONo52FkHCyZEUOQoZKKp/iQELtVVeRV5ps+Y3Ncof5NqMVQ06Cb2P9AaahqEGdAZwRq 9OwyYky27zGKo2Tk8YGhKroQHhdOmOufJ/hiSnE2DjdM/rkRXzbBHwGhs7tzkAoIRyKo pzgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=b3uF1FZTsyx9kbFOuPXyy2Jvt8jrVojMs1HrileFmHo=; b=JOeDupcsermKGsU3MxDwhvdS2QiVkK8D7xWqkVAdb60EfXz/zCy4eV/lrXGAQ+FTm0 0zBzMj6VhRbyL4nOtXSRiWo3pADK1XqvVjrge6nYNLYuNMIQ61X11sYm6ISITJJpFifp Idv9owx0N4o8Rgu6atEHGF2M51R8DIFTh3BxR2rglxjEpq9vV560wND5rJguHYv1MNhd dfuNxWvZwG4cIVVn1cClz+fPMg7hY6Lll3jn8Hie2vI53FDbF4qzpkEIdQf/OO4u2jRy mMm32b2eJ2E6Bv6a5WC44QLU8uS5Oui9depc/Ocug5D5E03+mb6vHo4psau++l9jSOwA X2NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id an9si2214409ejc.724.2021.04.15.07.38.28; Thu, 15 Apr 2021 07:38:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232642AbhDOOfX (ORCPT + 99 others); Thu, 15 Apr 2021 10:35:23 -0400 Received: from foss.arm.com ([217.140.110.172]:47666 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233489AbhDOOfU (ORCPT ); Thu, 15 Apr 2021 10:35:20 -0400 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 C3100106F; Thu, 15 Apr 2021 07:34:56 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7FC3B3FA45; Thu, 15 Apr 2021 07:34:55 -0700 (PDT) Date: Thu, 15 Apr 2021 15:34:53 +0100 From: Vincent Donnefort To: Quentin Perret Cc: peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, lukasz.luba@arm.com, dietmar.eggemann@arm.com Subject: Re: [PATCH] PM / EM: Inefficient OPPs detection Message-ID: <20210415143453.GB391924@e120877-lin.cambridge.arm.com> References: <1617901829-381963-1-git-send-email-vincent.donnefort@arm.com> <1617901829-381963-2-git-send-email-vincent.donnefort@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 15, 2021 at 01:16:35PM +0000, Quentin Perret wrote: > On Thursday 08 Apr 2021 at 18:10:29 (+0100), Vincent Donnefort wrote: > > --- a/kernel/sched/cpufreq_schedutil.c > > +++ b/kernel/sched/cpufreq_schedutil.c > > @@ -10,6 +10,7 @@ > > > > #include "sched.h" > > > > +#include > > #include > > #include > > > > @@ -164,6 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, > > > > freq = map_util_freq(util, freq, max); > > > > + /* Avoid inefficient performance states */ > > + freq = em_pd_get_efficient_freq(em_cpu_get(policy->cpu), freq); > > I remember this was discussed when Douglas sent his patches some time > ago, but I still find it sad we index the EM table here but still > re-index the cpufreq frequency table later :/ > > Yes in your case this lookup is very inexpensive, but still. EAS relies > on the EM's table matching cpufreq's accurately, so this second lookup > still feels rather unnecessary ... To get only a single lookup, we would need to bring the inefficiency knowledge directly to the cpufreq framework. But it has its own limitations: The cpufreq driver can have its own resolve_freq() callback, which means that not all the drivers would benefit from that feature. The cpufreq_table can be ordered and accessed in several ways which brings many combinations that would need to be supported, ending-up with something much more intrusive. (We can though decide to limit the feature to the low to high access that schedutil needs). As the EM needs schedutil to exist anyway, it seemed to be the right place for this code. It allows any cpufreq driver to benefit from the feature, simplify a potential extension for a usage by devfreq devices and as a bonus it speeds-up energy computing, allowing a more complex Energy Model. > > > if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) > > return sg_policy->next_freq; > > > > -- > > 2.7.4 > >