Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4236746pxj; Tue, 25 May 2021 03:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwor27uL0LthD/MxAWpBKjdi3aAOph/5I8kalKGIFowTR3IujNB4MNjW1Kwz6+q7I+V04VB X-Received: by 2002:aa7:db57:: with SMTP id n23mr31221738edt.229.1621938622438; Tue, 25 May 2021 03:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621938622; cv=none; d=google.com; s=arc-20160816; b=NKWJbVjjIgRHnkldxw5pHoaprtQRyblYMWdBSnINkQwKo6Xd5W8gqUWBD+N8a8pPJ7 2GHxyUQ5qN9I2jNlEnTg/kSFNWqqr15PcvPSirFsbo3fcUEf1i44ZDzaAuxz1IIXevNe UaFdGo1Ri3SwnXlaq4vQ04Fw5ldhtJ8zHze3Bw8ARFbRt7ZmfZ87o2fGd7wjaN36WTkw Mh1rcriIYtbH6CJ1aswu0/EokvKkyIZ5vGbDkm7UKm1KIpwt1Jtltto4IbeDBKFgF6jW NPWTm6XKtv5o4LUGQTz4GELYIYbYtug1H1NX6RiFa6snugnjC/xVHJ/N0EJilPJONBtJ ZKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IhdHrejb8oP7HF4BNxg6AJ7gMSwQljwx5iokXE2ziC4=; b=LDXRBYLN9ScfmSI2wNfjiD7YIaGLuozZ/3WFdV6AVHoE4Q8LBukkzeumLBQGiOf1Hc aSfTcX+RgpSGovEyLl8L9XfUDeFzbSclbWUOfaP0GhCaAibJO0sJmNX7UMDt3EgmRnUa XHsbHCstGui/wShgk+CZZmIEoDN5J+6L0zqyPam7dxW//soqRvIy+PpD7fGmmRFPrijn ujLToUMfpED+VHh+9cyGFv4ngSxe/NkJWTp9mRz82mM1jHAef6Q3HMt05Q2RrlJqVbgG Dm2IzgoBIAtyos8VkJvc31sRBY4JREPSM5rKg5JS9efCXCeD7eQNs46ZYEL1YKGKlXL3 Fh3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cy0uh2bI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si15419939eju.260.2021.05.25.03.29.59; Tue, 25 May 2021 03:30:22 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cy0uh2bI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbhEYIvD (ORCPT + 99 others); Tue, 25 May 2021 04:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhEYIvB (ORCPT ); Tue, 25 May 2021 04:51:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EB20C061574 for ; Tue, 25 May 2021 01:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IhdHrejb8oP7HF4BNxg6AJ7gMSwQljwx5iokXE2ziC4=; b=cy0uh2bIPIFr31viFMsd92QWSP 5pMGGmATdtpyOqUvZBOLOiCLjFreEzr3N/nUL+X/UJibma/Wq/0td38d7ia13EV/DxEZh43VYz9fg vHHh6dkDXVwGk06Hqv5TKDyw1D/caBlVb17fPRPyB7LHOosThekDOlRPMJ4Of4pDjlW1DNg5tmVrV W0gwLsMpogo9lxr7m3hy6lxW4h/pk1NpJWfFMlHj+3oJPbGdKLgbfi6WBvE3KAWh/IBPWO+oqjf/I 5we70QHyUS6sc2bZAISaEjO301ngOJVOqYBP8PZU5XZIBR/0KoNSM46tq1O+0eah0DahOOSX6hQmD 6f0pTglg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1llSjj-003IaJ-Vf; Tue, 25 May 2021 08:48:43 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E486730022A; Tue, 25 May 2021 10:48:23 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C823C30EA6427; Tue, 25 May 2021 10:48:23 +0200 (CEST) Date: Tue, 25 May 2021 10:48:23 +0200 From: Peter Zijlstra To: Vincent Donnefort Cc: rjw@rjwysocki.net, viresh.kumar@linaro.org, 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: References: <1621616064-340235-1-git-send-email-vincent.donnefort@arm.com> <1621616064-340235-4-git-send-email-vincent.donnefort@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1621616064-340235-4-git-send-email-vincent.donnefort@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :/