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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 85107C433DB for ; Fri, 8 Jan 2021 13:02:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43124235FC for ; Fri, 8 Jan 2021 13:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727016AbhAHNCA (ORCPT ); Fri, 8 Jan 2021 08:02:00 -0500 Received: from foss.arm.com ([217.140.110.172]:51048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbhAHNB7 (ORCPT ); Fri, 8 Jan 2021 08:01:59 -0500 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 41543ED1; Fri, 8 Jan 2021 05:01:14 -0800 (PST) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 950DB3F719; Fri, 8 Jan 2021 05:01:12 -0800 (PST) Date: Fri, 8 Jan 2021 13:01:10 +0000 From: Qais Yousef To: Mel Gorman Cc: Peter Zijlstra , "Li, Aubrey" , vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, mingo@redhat.com, juri.lelli@redhat.com, valentin.schneider@arm.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, tim.c.chen@linux.intel.com, benbjiang@gmail.com Subject: Re: [RFC][PATCH 1/5] sched/fair: Fix select_idle_cpu()s cost accounting Message-ID: <20210108130110.cj3zqsnjdt5mg3uz@e107158-lin> References: <20201214164822.402812729@infradead.org> <20201214170017.877557652@infradead.org> <20201215075911.GA3040@hirez.programming.kicks-ass.net> <20210108102738.GB3592@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210108102738.GB3592@techsingularity.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/08/21 10:27, Mel Gorman wrote: > for_each_cpu_wrap(cpu, cpus, target) { > - if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) > + if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) { > + /* Adjust cost of a successful scan */ > + loops <<= 2; > + > break; > + } > > - if (loops >= nr) { > + if (++loops >= nr) { > cpu = -1; > break; > } > - loops++; Random (out of the blue) comment. Now this will increment loops before the comparison/break. ie: we're effectively doing one iteration less IIRC. Should loops be initialized to 0 instead of 1? Thanks -- Qais Yousef