Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4371862pxj; Tue, 25 May 2021 06:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlQJDF9bfPWZu2bWRJkCc4uQFFUQdfWBl0nGvF30u8MAgd8Ktgv7Q8VY+ncgmmCVMJD24b X-Received: by 2002:a17:906:33da:: with SMTP id w26mr28972013eja.242.1621949778377; Tue, 25 May 2021 06:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621949778; cv=none; d=google.com; s=arc-20160816; b=UcFmarlRHQaS/3Kyui4XF2wDPEjbip+TxgiwFFkJl0jzdlE8EPFGeipobu6Q6wrcH8 6gh/IobSPFbH4wqbvsduMweLC5FmlnSsmlPHEQb0d6w2YS9mPd2Nl+XS3nkoc1w9yhK+ lI+ToEuw6wpa9jEad/AnwC4hS4FlrMzI2DeYsfL4vsjB3wr/NHqsjbReQkDfKTFzp3HF A4Nv751zT/O5P+Vpgxu5snNnH0uWDNdhKZcEspz2dKaO2RGyrlH++kSbfrrf39NthK+y XfxhfmBaIteM6R7uBQ0D8Z8zrASUqpsyXHZ/gm56VAc9MchjTAZXhFES6/PAfUWk+pzS Il1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=HGqJzMfssSrRBwVIjckPKWp5FNZb8AILCAG9KA3AYTs=; b=OL9PHOSBNSXkoxiV9w8x5xHDeub9p9BH6HJC4+oBXmG5S0+E3FNXEO54KdQZjtA3Mn eNTGTNQwxJUNMhl3DOZhI973PLJFutNSqDeCeziumLz64WL+IFZENvMcIT3nXMH9w/Fo cjD29krD7yP29CTJ2L61pepn9ZvCDtOFJdz2i3wmmslmbv36JTfMATPVc+tON23ihPoW JZHMX7C0goAR2p0N5n5NGZMHvDrD1m/DLmu6ksn6qum9ObZXrZWSAwivYCPVO5foPpAF f//6cAZIA+q/orqO/NU8PHobQTjNfT+tSnonZ4x+AzxjHOqhS1uILR3FIQoQ9wZS8aPa +teQ== 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 a22si15900458eje.230.2021.05.25.06.35.55; Tue, 25 May 2021 06:36:18 -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 S233176AbhEYNfs (ORCPT + 99 others); Tue, 25 May 2021 09:35:48 -0400 Received: from foss.arm.com ([217.140.110.172]:56204 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbhEYNfr (ORCPT ); Tue, 25 May 2021 09:35:47 -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 0AFC01042; Tue, 25 May 2021 06:34:18 -0700 (PDT) Received: from [10.57.2.8] (unknown [10.57.2.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7CBEC3F719; Tue, 25 May 2021 06:34:15 -0700 (PDT) Subject: Re: [PATCH v2 3/3] PM / EM: Skip inefficient OPPs To: Quentin Perret Cc: Vincent Donnefort , peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, dietmar.eggemann@arm.com References: <1621616064-340235-1-git-send-email-vincent.donnefort@arm.com> <1621616064-340235-4-git-send-email-vincent.donnefort@arm.com> <20210525094601.GB369979@e124901.cambridge.arm.com> From: Lukasz Luba Message-ID: Date: Tue, 25 May 2021 14:34:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, On 5/25/21 2:06 PM, Quentin Perret wrote: > Hi Lukasz, > > On Tuesday 25 May 2021 at 12:03:14 (+0100), Lukasz Luba wrote: >> That's a few more instructions to parse the 'flags' filed. I'm not sure >> if that brings speed improvements vs. if we not parse and have bool >> filed with a simple looping. The out-of-order core might even suffer >> from this parsing and loop index manipulations... > > I'm not sure what you mean about parsing here? I'm basically suggesting > to do something along the lines of: I thought Vincent was going to re-use the 'flags' for it and keep it for other purpose as well - which would require to parse/map-to-feature. That's why I commented the patch earlier, pointing out that we shouldn't prepare the code for future unknown EM_PERF_STATE_*. We can always modify it when we need to add another feature later. > > diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h > index daaeccfb9d6e..f02de32d2325 100644 > --- a/include/linux/energy_model.h > +++ b/include/linux/energy_model.h > @@ -128,13 +128,11 @@ struct em_perf_state *em_pd_get_efficient_state(struct em_perf_domain *pd, > > for (i = 0; i < pd->nr_perf_states; i++) { > ps = &pd->table[i]; > - if (ps->flags & EM_PERF_STATE_INEFFICIENT) > - continue; > if (ps->frequency >= freq) > break; > } > > - return ps; > + return &pd->table[ps->next_efficient_idx]; > } > > What would be wrong with that? Until we measure it, I don't know TBH. It looks OK for the first glance. I like it also because it's self-contained, doesn't require parsing, doesn't bring any 'generic' variable. Regards, Lukasz > > Thanks, > Quentin >