Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3177337pxu; Tue, 15 Dec 2020 00:04:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOjfIAp4c8lUi9Q9+p3uIjL3OttLsqYQTVYNm0FNhvUoWCjxbi2aX3GHwq7PMBHGxGHgG5 X-Received: by 2002:a17:906:dd3:: with SMTP id p19mr3936725eji.221.1608019461789; Tue, 15 Dec 2020 00:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608019461; cv=none; d=google.com; s=arc-20160816; b=x2cNb+rRPyyvupdvYMySq4PgeqGRbqXoyz3PLgepO4zZ6MXYAr3ZVLLgn4X3IKEBpl iZvyn5O454aft3u2Tl5GgbJShZ2JZcCG1xMbPx0NaK2aTezGJw5QSBemViP2OLoodbCJ Y8v6cxBjCIXODe2KZTk3vnWv7VY/a38maKB+ABbdoVy6egH9tKDM71oUA4ZVoprA4YvR rv0n4/MmEmrX3mTuJJ/5UcT6vkdCVNxnuUzQm4c73uzx271byMwKDNreviq7ngdQLvQ8 xIiE3yIi4lg8snq7wZq60OBW1GfQ0EwmkEh8gikmJ3r1Xd/SBPWkcr0JUn/BFXnT9eSJ YBDQ== 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=vlmMgAa2QEYiSS7lGJm7ACi0lKBxrujPFHmQpD6je1M=; b=p0XlrtCUak8cxesYlpTF56SG8BInv1w2QmtpmXhbsRQCsQpzdjpcwPD0/HY4rmRnU5 yd5lKUFI4RZ1Xv7d8ukZf6ufyVzZXzf6LdZaU1QAQSQLbJt6Tq3ttmlHhSwKBumFDsEl NE6PIxJZH5tB/ihGa/HalrUYzZrdh3TCjHV2dXYyZvCh5YNztcU2xWQjPlDyngyIW118 7RxMGuMcdCUQi3fjrz1EgiL4ATddze9ZENFB0m4rrjOGjMTbcWFHQqK3kywhr8bT22Cg DGLx9RrGM8k5Kxpb8tls1fr/H94je7hffJ7qelAybda9HD3+0sKGJnIAXZCNAkOGsSyL ep9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=bot1FTLv; 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 q9si444183edr.98.2020.12.15.00.03.55; Tue, 15 Dec 2020 00:04:21 -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=bot1FTLv; 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 S1726249AbgLOIAZ (ORCPT + 99 others); Tue, 15 Dec 2020 03:00:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbgLOIAI (ORCPT ); Tue, 15 Dec 2020 03:00:08 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28260C06179C for ; Mon, 14 Dec 2020 23:59:28 -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=vlmMgAa2QEYiSS7lGJm7ACi0lKBxrujPFHmQpD6je1M=; b=bot1FTLv7CI6g/SdHWmN4+UEiU 4lA4xmxntvsiGdFRqt+lbUB6lK19Go/UrZCG61eNIzVrK88yr9K4sq8jOVhHs2p8Qvq1ZEpo/pQRp NwgLCrBsD7zPm83HQyDIYRIQwjFaBVeKc78bjPiYwmxkh9i4WKefR7awvhtOrGOu39WfyzHdO7dJW UUjZHsngiBhs3VIlu/caxkbdHn9XdJUtVB6pjjC5snihpIGJPcWIo86X4phMHenSUTSBn37T66Ta3 L2tfqcg2fcSqMHszcHK7klkh18YbjjpUd1hw/74nEs9NNBqsfWcZEHuvNRkabIZfaf+UF9CXQbjUd 2hqNJ2cQ==; 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 1kp5Eo-0006sr-21; Tue, 15 Dec 2020 07:59:14 +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 93C18302753; Tue, 15 Dec 2020 08:59:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 77BEE20D21018; Tue, 15 Dec 2020 08:59:11 +0100 (CET) Date: Tue, 15 Dec 2020 08:59:11 +0100 From: Peter Zijlstra To: "Li, Aubrey" Cc: mgorman@techsingularity.net, 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: <20201215075911.GA3040@hirez.programming.kicks-ass.net> References: <20201214164822.402812729@infradead.org> <20201214170017.877557652@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 15, 2020 at 11:36:35AM +0800, Li, Aubrey wrote: > On 2020/12/15 0:48, Peter Zijlstra wrote: > > We compute the average cost of the total scan, but then use it as a > > per-cpu scan cost when computing the scan proportion. Fix this by > > properly computing a per-cpu scan cost. > > > > This also fixes a bug where we would terminate early (!--nr, case) and > > not account that cost at all. > > I'm a bit worried this may introduce a regression under heavy load. > The overhead of adding another cpu_clock() and calculation becomes > significant when sis_scan is throttled by nr. The thing is, the code as it exists today makes no sense what so ever. It's plain broken batshit. We calculate the total scanning time (irrespective of how many CPUs we touched), and then use that calculate the number of cpus to scan. That's just daft. After this patch we calculate the avg cost of scanning 1 cpu and use that to calculate how many cpus to scan. Which is coherent and sane. Maybe it can be improved, but that's a completely different thing.