Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1185205rwo; Wed, 2 Aug 2023 09:55:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGy0zpfyoFoCR1i0Wnrfn26FlLzIXWZk4wUc+qkOKH6zW6gInkgifQZ+2MjqiLlzcgB0wS X-Received: by 2002:a19:2d4b:0:b0:4f7:6966:36fb with SMTP id t11-20020a192d4b000000b004f7696636fbmr5194479lft.12.1690995356909; Wed, 02 Aug 2023 09:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690995356; cv=none; d=google.com; s=arc-20160816; b=ZzDaIcKZwLd90f1GKEQitFs170TVNxaJyJVmgPLQ4ubG929IHWX6Vk7JGsYx15v4yw ERvM+4ot8hS2AYHyRUyXktl2ChujsMLP7HsmVuEbyc93C3GtRtjAqVZOcYhyDnKjT6TQ bIu1FX3uG/Y20ptYLjzOLnmP6hreuXxPPYQMVIbo1F6j2yAvQKGs9EI2khLjOw/Ys66o RCMQjDjv/qyHlfkZ0ma4pkz8bGlUUFk1Q3b745hUzaE1WTdy46OxEy6HV3gk5DarlVrv E1sceGoIezyqQZvJ8G4bQwb6GKjKhrvQALAHGKwRO6WycnV/bgDK6TVAaUQhwKXmEF+A dFbw== 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=LImLObs3PbfWRmVyYwazP2aaA0QKB8bTTtlThaSyFQc=; fh=+Plke4XPDCs/WzqPVIFPG+9UkpXs0GbpoCE+n/QFNBQ=; b=laFU3iFqnOhx+BnJaP/fblNME97aHoIO2oeOVFvtGykxyvUQzTxbkVFHsKQ69OY+va /gRwHNace5G7x7ilRuENaqJjwRFF32uwtpxXjOrAkf14vC2gQG7pkdc8XBnWmYAH7a7q 5A0ljve7Y4zoBXCxIKCeEOZU8SHdX59JG/SWJjiRcQUNbLEVbRS+BE/cMGehohD2aMLh Dg3AAD9W6/i8izIz/I03qOmZYFa+TmSN1Wzyn0pLqbHcxJ31TQvPMvXYFXtG8vZalv3b KkjlaHHJHq8b3r/O0Og8vDMm98OCBYXnF9vT1rIHJbvbftUteK/G6grpkTtsketI2SzK 0Lmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=oPsrUIn+; 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 f4-20020a056402068400b0051a2c8c1e4esi10220623edy.418.2023.08.02.09.55.32; Wed, 02 Aug 2023 09:55:56 -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=desiato.20200630 header.b=oPsrUIn+; 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 S234317AbjHBPsy (ORCPT + 99 others); Wed, 2 Aug 2023 11:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232069AbjHBPsq (ORCPT ); Wed, 2 Aug 2023 11:48:46 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB45C1735 for ; Wed, 2 Aug 2023 08:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=LImLObs3PbfWRmVyYwazP2aaA0QKB8bTTtlThaSyFQc=; b=oPsrUIn++gGVB1cVF8en2q3Ucd 5GTIohXyXNKbdDGldSnxZCvsCuFwALvV3SPb0q++JunJbI6FjjNPG9cZx/RUPm2UBR04uBhkG88XQ 4dhAal277kVoHtsLYNIiH3dhzX1ER//Xw5s14AZ0lwSYr4DatgroBqyVFG4teTt5DAyT6Bu/cOOt1 FfBMM68QZ4ui3mt3w76rx1YwOTFEYeP3yyoYhNd5STQ7RJdDwiEp+FBhjfumb3WHSjXpJ0PDz1NnP MbBNZM5d59AS2Rv7LF5ECtCU57pvYdLruMr/bc6OncQ0OE2k/pDslsHtHibm/bSZbLNPRBBk91mkT BDYxwRwQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qRE5P-00G2gC-09; Wed, 02 Aug 2023 15:48:31 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 011D73001DD; Wed, 2 Aug 2023 17:48:30 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E19FA210A8CBB; Wed, 2 Aug 2023 17:48:29 +0200 (CEST) Date: Wed, 2 Aug 2023 17:48:29 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de Subject: Re: [PATCH 2/2] mm,nodemask: Use nr_node_ids Message-ID: <20230802154829.GB214207@hirez.programming.kicks-ass.net> References: <20230802112458.230221601@infradead.org> <20230802112525.633758009@infradead.org> <20230802153251.GF2607694@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230802153251.GF2607694@kernel.org> 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, Aug 02, 2023 at 06:32:51PM +0300, Mike Rapoport wrote: > > +/* > > + * We have several different "preferred sizes" for the nodemask > > + * operations, depending on operation. > > + * > > + * For example, the bitmap scanning and operating operations have > > + * optimized routines that work for the single-word case, but only when > > + * the size is constant. So if NR_CPUS fits in one single word, we are > > ^ MAX_NUMNODES? > > > + * better off using that small constant, in order to trigger the > > + * optimized bit finding. That is 'small_nodemask_size'. > > + * > > + * The clearing and copying operations will similarly perform better > > + * with a constant size, but we limit that size arbitrarily to four > > + * words. We call this 'large_nodemask_size'. > > + * > > + * Finally, some operations just want the exact limit, either because > > + * they set bits or just don't have any faster fixed-sized versions. We > > + * call this just 'nr_nodemask_bits'. > > + * > > + * Note that these optional constants are always guaranteed to be at > > + * least as big as 'nr_node_ids' itself is, and all our nodemask > > + * allocations are at least that size (see nodemask_size()). The > > We don't have nodemask_size(). NODEMASK_ALLOC() actually allocates memory > only when NODE_SHIFT > 8 and it always uses the static size. > > > + * optimization comes from being able to potentially use a compile-time > > + * constant instead of a run-time generated exact number of CPUs. > > ^ nodes? Durr, clearly I didn't actually read the comment after I 'borrowed' it and regex'ed it into 'shape'. I'll go fix, thanks!