Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp581872pxb; Fri, 8 Jan 2021 12:25:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzN+KofLG0B1Sc+rZHHf5VzZQ16jSVLl+TpLH0tx47qR0Pc6DTZnfJRNtZuU5BGJGWJbaoy X-Received: by 2002:a50:b282:: with SMTP id p2mr6767754edd.210.1610137539392; Fri, 08 Jan 2021 12:25:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610137539; cv=none; d=google.com; s=arc-20160816; b=swRA+2MMHH7/AoGfhZgYOMgvNR88h5OUeA751sDcnY06NKvtSZdxWz94bih7b/dYnq 3F0ueWGNfBToyxUjaVp+zG5FTXcbOo3DuaZt+JhbQJ3HMeqibHnDlIsE9TrSxm1JVOjf Cyr8rgx0Cm9mT8Hi6/3zcGT3oXY/YYlain9v5WZwy2ltVVOCmjADs4N4G+KjJ7TpMVQf 1QHuwz4mw5t3gIBQaiwD3vMQkn6VIUbdZI05BFW/pz+XXRuSr0994tpx/S7/gNsex6uG 9ZYKKUzEhHmfbbsQE+w5I82ck+faln1rVnec3YMbwWLVxa39KRQ2Esg+8qZvDhKAA18K H68A== 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=bw5Xer4Ybhizh77HcltjwUcBtD+6iJDpHkeVTArX14A=; b=KQ5MfXYqec0lS60t4ud4/IkK/NlX4/2HHxSNqHwP6k+lDJfbmp+BNrOp6zjh0I7nZH JD+9d+ksm8gm3516H4bjY0dcD8RiWasj4cMTug3f9cP8FAXttI0TEXI01o6h2eo25gk2 771qPlmFfrF34pIY39nmSMGnH7Yy5bLQVDqO99avxAoJiZ/I/lajXRssn5CGIo6YDxsW PFcTXtrmRRJmBB0Ck9DDkmOdXHSekQc2NOlT/yOgwk2xeQyWHLjjXzGTn7Il7thtzvqw mUzx89Jb3GrbJufi4wwUtI+qOmQIO2+kWC2s591S+y4NKeVPYvA07jGafyLZ/dnTPb/A t8Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=VXo4Yifl; 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 ak17si1430095ejc.288.2021.01.08.12.25.16; Fri, 08 Jan 2021 12:25:39 -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; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=VXo4Yifl; 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 S1729014AbhAHUWp (ORCPT + 99 others); Fri, 8 Jan 2021 15:22:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728694AbhAHUWo (ORCPT ); Fri, 8 Jan 2021 15:22:44 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EDFFC061380 for ; Fri, 8 Jan 2021 12:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=bw5Xer4Ybhizh77HcltjwUcBtD+6iJDpHkeVTArX14A=; b=VXo4Yifl3CsWRfWJ99e4iYVfN+ JzhCTJJzJVXf6vACcrcIL9Znm+si25hhZ8imrJHmkUrWagPm9qZKLOI4UO3/LLLFe18yWsrVKBNHg KByMjJe2z12RCtBn3wcIxA68vyr+lZh2Duft/lkHZhfEqNyLhlJ+0y4vyXFVd3uWXXWTwahB09yOm ZviviUCTC0U21S3ZZzuuSdTKZ8FZhOlnw8OeDBAPNBHLbklSidyY49pkpQF9lTF6dSRBBW/ozXkzB /vOP0p/N6OhHKGOgGkqUZJXEaAzgD8xHK3hsK+sUxD3lhUYYwQtsLNzBR8XYzrhmp7ZW93Sy/ylBL ceApNzJA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxyGc-0003Hu-Ik; Fri, 08 Jan 2021 20:21:50 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 648A83013E5; Fri, 8 Jan 2021 21:21:48 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 460762C7BCF2D; Fri, 8 Jan 2021 21:21:48 +0100 (CET) Date: Fri, 8 Jan 2021 21:21:48 +0100 From: Peter Zijlstra To: Mel Gorman Cc: "Li, Aubrey" , vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, mingo@redhat.com, juri.lelli@redhat.com, valentin.schneider@arm.com, qais.yousef@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: 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=us-ascii Content-Disposition: inline In-Reply-To: <20210108102738.GB3592@techsingularity.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 08, 2021 at 10:27:38AM +0000, Mel Gorman wrote: > 1. avg_scan_cost is now based on the average scan cost of a rq but > avg_idle is still scaled to the domain size. This is a bit problematic > because it's comparing scan cost of a single rq with the estimated > average idle time of a domain. As a result, the scan depth can be much > larger than it was before the patch and led to some regressions. > @@ -6164,25 +6164,25 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t > */ > avg_idle = this_rq()->avg_idle / 512; > avg_cost = this_sd->avg_scan_cost + 1; > - > - span_avg = sd->span_weight * avg_idle; > - if (span_avg > 4*avg_cost) > - nr = div_u64(span_avg, avg_cost); > - else > + nr = div_u64(avg_idle, avg_cost); > + if (nr < 4) > nr = 4; Oooh, could it be I simply didn't remember how that code was supposed to work and should kick my (much) younger self for not writing a comment? Consider: span_weight * avg_idle avg_cost nr = ---------------------- = avg_idle / ---------- avg_cost span_weigt Where: avg_cost / span_weight ~= cost-per-rq