Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp935319rwo; Wed, 2 Aug 2023 06:31:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlHEb4uCPHOxlW5+R8oAHRGrFxzL8IL/6boVMMgHQiphxCo41Zt9Y/uTcGJtBGZ1locP2b6Q X-Received: by 2002:a19:5059:0:b0:4fb:a0f1:f8b8 with SMTP id z25-20020a195059000000b004fba0f1f8b8mr4317986lfj.63.1690983060711; Wed, 02 Aug 2023 06:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690983060; cv=none; d=google.com; s=arc-20160816; b=it6KMc+xDnS4BJsMV62Ld6/0Enz+gqvczm6BUPZOvzQIVKywIvU4xkETRiqMTgOMYE FvrZwNU7swvl7j4Ac+6akguk9wgEx04z0IkgUjepcLxVED0Zz5RUp8wThC/4oxa3F7Z9 HBhUcos1vPmjbtLpvelZ9TFQEgZfybbfUEx9MGc5F1NDAGuo4i2D/BXkvoq2375gPJ8h /lvfAT9+LWzu+69CReJO6N611ceYMcbnNDpmgmLq9c/8jAUTlIzRnmzdSlKroPe+PuRZ HWvHHNwCXv4ccuZOOSYSmdE7SqxvW5mCmNYKE7JgPcLVgItbhDXLcngvUB0oC3MwqRIP jDxQ== 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=nbWLCh6y7Cw+zeOnkHNhVKQHXAW0ky+JovdC+xMpaP8=; fh=6RYZwOxyRINKZtGAKMuIS3p0dCKV6PWxX7Xvwid/omU=; b=bEGGvW5Dleq1XSDXwnolL4CIcKEfutlRqcefqgI0MWkHGsEbpkTza8N+AOyEi7t1CH 56gMZgGS1FKemlyO95wJeVB0vmFdDO1glvWi68BfycYXTK0yrlO6apwFpb54GNJeLJIq sLetHryvSjpul3tMJ9nzOyWjnwDBdIyxY0BEP60xpOpvwW3slEUrcZuY7O1Tps5RO3oT en43b/MVfxHZ/LzCg/OWF8gnOLPuIS+ZlasqA+dnygw2jkYy9H/wEi8JpRHcXTOftrUq pi6pHnB78W9E2vnI9YVeJqZ3p6NgF//6roULqw8TBjsplCOI2cfnTxgqQIfJ5CHZWWLr bG+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UV9eCJcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a056402050900b00522d7b6b25dsi3891269edv.243.2023.08.02.06.30.26; Wed, 02 Aug 2023 06:31:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UV9eCJcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233767AbjHBL27 (ORCPT + 99 others); Wed, 2 Aug 2023 07:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231667AbjHBL26 (ORCPT ); Wed, 2 Aug 2023 07:28:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482222121 for ; Wed, 2 Aug 2023 04:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=nbWLCh6y7Cw+zeOnkHNhVKQHXAW0ky+JovdC+xMpaP8=; b=UV9eCJcAH106EAWOx6HE/59IMt K9/Gfwn4MzPjxhsvgRVKHRNyXkl/0BZwDj6rPwBUdJZKhDQdweL865E7benpWHT/G6tZRqok+C0aX QINbN36O2f738F1pCwsa6r7/gpB1V3MfHD2u6lSfn5zYHf7o0xTUaopl9PSR1wGtdaoAp3j4m/XfV +mEfM7OJ34usd0bvj1FxvUy1Cg1hu2X4J+LhhpmLaRUCx9refilehUisx5fRwR5u74u969qEwexUT EnYuWJ+t6hjax6QXZaamLmP8L9+p4K2g1o4TXE98G9oe4dnpGpPru/kAg5srulmBFFFQfhjHRapYU WV6ffkWg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRA1t-00EfzW-0X; Wed, 02 Aug 2023 11:28:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4F1263001DD; Wed, 2 Aug 2023 13:28:36 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2FE382066B200; Wed, 2 Aug 2023 13:28:36 +0200 (CEST) Date: Wed, 2 Aug 2023 13:28:36 +0200 From: Peter Zijlstra To: Aaron Lu Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Daniel Jordan , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Tim Chen , Nitin Tekchandani , Yu Chen , Waiman Long , linux-kernel@vger.kernel.org, yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, rppt@kernel.org Subject: Re: [RFC PATCH 2/4] sched/fair: Make tg->load_avg per node Message-ID: <20230802112836.GA212435@hirez.programming.kicks-ass.net> References: <20230718134120.81199-1-aaron.lu@intel.com> <20230718134120.81199-3-aaron.lu@intel.com> <20230719115358.GB3529734@hirez.programming.kicks-ass.net> <20230719134500.GB91858@ziqianlu-dell> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230719134500.GB91858@ziqianlu-dell> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 19, 2023 at 09:45:00PM +0800, Aaron Lu wrote: > On Wed, Jul 19, 2023 at 01:53:58PM +0200, Peter Zijlstra wrote: > > On Tue, Jul 18, 2023 at 09:41:18PM +0800, Aaron Lu wrote: > > > +#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP) > > > +static inline long tg_load_avg(struct task_group *tg) > > > +{ > > > + long load_avg = 0; > > > + int i; > > > + > > > + /* > > > + * The only path that can give us a root_task_group > > > + * here is from print_cfs_rq() thus unlikely. > > > + */ > > > + if (unlikely(tg == &root_task_group)) > > > + return 0; > > > + > > > + for_each_node(i) > > > + load_avg += atomic_long_read(&tg->node_info[i]->load_avg); > > > + > > > + return load_avg; > > > +} > > > +#endif > > > > So I was working on something else numa and noticed that for_each_node() > > (and most of the nodemask stuff) is quite moronic, afaict we should do > > something like the below. > > > > I now see Mike added the nr_node_ids thing fairly recent, but given > > distros have NODES_SHIFT=10 and actual machines typically only have <=4 > > nodes, this would save a factor of 256 scanning. More complete nodemask patch here: https://lkml.kernel.org/r/20230802112458.230221601%40infradead.org