From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 756F0C4708F for ; Tue, 1 Jun 2021 08:47:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5902561396 for ; Tue, 1 Jun 2021 08:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233661AbhFAItW (ORCPT ); Tue, 1 Jun 2021 04:49:22 -0400 Received: from foss.arm.com ([217.140.110.172]:43640 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233680AbhFAItR (ORCPT ); Tue, 1 Jun 2021 04:49:17 -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 93F731FB; Tue, 1 Jun 2021 01:47:36 -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 5CADA3F73D; Tue, 1 Jun 2021 01:47:35 -0700 (PDT) Date: Tue, 1 Jun 2021 09:47:25 +0100 From: Vincent Donnefort To: Viresh Kumar Cc: Peter Zijlstra , rjw@rjwysocki.net, vincent.guittot@linaro.org, qperret@google.com, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, lukasz.luba@arm.com, dietmar.eggemann@arm.com Subject: Re: [PATCH v2 3/3] PM / EM: Skip inefficient OPPs Message-ID: <20210601084725.GA223449@e120877-lin.cambridge.arm.com> References: <1621616064-340235-1-git-send-email-vincent.donnefort@arm.com> <1621616064-340235-4-git-send-email-vincent.donnefort@arm.com> <20210528050934.muji5bv7ed4k4t6j@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210528050934.muji5bv7ed4k4t6j@vireshk-i7> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 28, 2021 at 10:39:34AM +0530, Viresh Kumar wrote: > On 25-05-21, 10:48, Peter Zijlstra wrote: > > On Fri, May 21, 2021 at 05:54:24PM +0100, Vincent Donnefort wrote: > > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > > > index 4f09afd..5a91a2b 100644 > > > --- a/kernel/sched/cpufreq_schedutil.c > > > +++ b/kernel/sched/cpufreq_schedutil.c > > > @@ -10,6 +10,7 @@ > > > > > > #include "sched.h" > > > > > > +#include > > > #include > > > #include > > > > > > @@ -153,6 +154,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); > > > + > > > if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) > > > return sg_policy->next_freq; > > > > > > > This seems somewhat unfortunate, it adds a loop over the OPPs only to > > then call into cpufreq to do the exact same thing again :/ > > And that's why I feel it needs to be done at a single place, either disable the > OPP (which seems like a bad option based on what Lukasz and Vincent said > earlier), or make changes in the cpufreq core itself to search for the best > frequency (like adding another API to mark some frequencies as inefficient, and > take that into account while selecting next freq). > > There is a potential of ending up selecting the wrong frequency here because > there are too many decision making bodies here and so corner cases. > > -- > viresh Hi Viresh, Seems like no one has been really convinced about the arguments in favor of keeping inefficiencies into EM :) Let me then give a shot with marking the OPPs for the next version. -- Vincent