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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 966EEC49EA3 for ; Mon, 14 Jun 2021 13:40:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F3D9611CE for ; Mon, 14 Jun 2021 13:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234213AbhFNNmU (ORCPT ); Mon, 14 Jun 2021 09:42:20 -0400 Received: from foss.arm.com ([217.140.110.172]:36406 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234090AbhFNNmS (ORCPT ); Mon, 14 Jun 2021 09:42:18 -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 0DE3F6D; Mon, 14 Jun 2021 06:40:16 -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 B07D43F719; Mon, 14 Jun 2021 06:40:14 -0700 (PDT) Date: Mon, 14 Jun 2021 14:40:12 +0100 From: Vincent Donnefort To: Matthias Kaehlcke Cc: peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, vincent.guittot@linaro.org, qperret@google.com, linux-pm@vger.kernel.org, ionela.voinescu@arm.com, lukasz.luba@arm.com, dietmar.eggemann@arm.com Subject: Re: [PATCH v3 3/6] cpufreq: Add an interface to mark inefficient frequencies Message-ID: <20210614134012.GB34061@e120877-lin.cambridge.arm.com> References: <1622804761-126737-1-git-send-email-vincent.donnefort@arm.com> <1622804761-126737-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: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org > > + for (;;) { > > + pos = &table[idx]; > > + > > + if (pos->frequency == CPUFREQ_ENTRY_INVALID) > > + continue; > > That would result in an infinite loop, you still want to execute the code > at the bottom of the loop which increments/decrements 'idx' and exits the > loop when the end of the table is reached. Arg, indeed, sorry for that ugly thing. I'll wait for more input from Viresh before submitting a fixed version. > > > + > > + if (pos->flags & CPUFREQ_INEFFICIENT_FREQ) { > > + pos->efficient = efficient; > > + } else { > > + pos->efficient = idx; > > + efficient = idx; > > + } > > + > > + if (sort == CPUFREQ_TABLE_SORTED_ASCENDING) { > > + if (--idx < 0) > > + break; > > + } else { > > + if (table[++idx].frequency == CPUFREQ_TABLE_END) > > + break; > > + } > > + } > > +} > > +