Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp312089pxb; Fri, 8 Jan 2021 05:49:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwemhzllMXAvkNMGtFXGzmef7ZwBf7Aq/+FTZJhvk2jyj96hs4B1EwifjtkZzkFvobSJOed X-Received: by 2002:a17:906:4443:: with SMTP id i3mr2556907ejp.133.1610113786011; Fri, 08 Jan 2021 05:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610113786; cv=none; d=google.com; s=arc-20160816; b=rVMjJjUl/kRaJiph/uU79pHME4LwfySkeaB/YM+7TPwQVA9TwJh4j6v1u0h+W6d1dK YZB8qKRYgtuwvY2Z11p2mw0df2l8wg6cWiZQS/qLi/TWkFMc9ezLSMK8+LigKe2WWPLi z8P+w9oOorQx92hv50HYQmQuVAUJi3fj2r4xwf0J6ytmJZjqR5TfNenahIE2v8Mveud0 GQEjzp+F2U1Yd3WkoilT0nr3Tif5J2YtBHYwQnHdMnVfMYtf91mmfHBGZcyH266ipEPC WVyVw+Cw8+HH62HAGKl5JfmqQ8VSF8INMTeuwYiR9C6B12X+cHJ0blIMxL+Y3Tvuxgss Ix1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=O4FkyIPqJm05obwyBFN6tx06CvtygKZT/kzdiFM/0S4=; b=v+nRsz+zcIxnqo3OLS67t/wvr7ZnfZLcZ20OWn5FiBb2ymYB7+qD9rwBz3YSVVfdHQ u0lbHo1nYcmKCzUMqGWfSPNPl1YxmlwjhXCZPudq2rIqNRXDpKn4hb5xApPkwvWecdYh +SPY8cS3J0LMXNkmHBjfZMrnuNQJOTf0ehcxffJ19WCNS1d/OmY1vaufLmxHQC2pRtem JzUvPIiydQucIO4EiNWwFlWDF258dM0dGh+Mfm7XpbvzQwoyHAXtEipcb1OVPerHtw4c amMmp+N0z+t7NcROz8MBPtPj7QEY5iQN1wqlwLgXZjjNc3UColJavvqA49zI4Y8TtsYC 5kNg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp17si3614792ejb.516.2021.01.08.05.49.21; Fri, 08 Jan 2021 05:49:45 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727934AbhAHNsa (ORCPT + 99 others); Fri, 8 Jan 2021 08:48:30 -0500 Received: from outbound-smtp46.blacknight.com ([46.22.136.58]:59557 "EHLO outbound-smtp46.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbhAHNs3 (ORCPT ); Fri, 8 Jan 2021 08:48:29 -0500 Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp46.blacknight.com (Postfix) with ESMTPS id CE72DFB4D5 for ; Fri, 8 Jan 2021 13:47:37 +0000 (GMT) Received: (qmail 2071 invoked from network); 8 Jan 2021 13:47:37 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 8 Jan 2021 13:47:37 -0000 Date: Fri, 8 Jan 2021 13:47:36 +0000 From: Mel Gorman To: Qais Yousef 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: <20210108134736.GC3592@techsingularity.net> References: <20201214164822.402812729@infradead.org> <20201214170017.877557652@infradead.org> <20201215075911.GA3040@hirez.programming.kicks-ass.net> <20210108102738.GB3592@techsingularity.net> <20210108130110.cj3zqsnjdt5mg3uz@e107158-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210108130110.cj3zqsnjdt5mg3uz@e107158-lin> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 08, 2021 at 01:01:10PM +0000, Qais Yousef wrote: > 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? > Yep, although in practice it'll make little difference except after a rapid phase change when avg_idle still appears high on a per-rq basis yet the domain is fully busy with no idle CPUs. -- Mel Gorman SUSE Labs