From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78CD4C04E69 for ; Wed, 2 Aug 2023 15:48:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E629B2801BD; Wed, 2 Aug 2023 11:48:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEB992801AA; Wed, 2 Aug 2023 11:48:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8CF62801BD; Wed, 2 Aug 2023 11:48:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B64552801AA for ; Wed, 2 Aug 2023 11:48:40 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 69D441A06F0 for ; Wed, 2 Aug 2023 15:48:40 +0000 (UTC) X-FDA: 81079597200.23.E14C96D Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf18.hostedemail.com (Postfix) with ESMTP id 8777F1C0018 for ; Wed, 2 Aug 2023 15:48:36 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=oPsrUIn+; dmarc=none; spf=none (imf18.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690991318; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LImLObs3PbfWRmVyYwazP2aaA0QKB8bTTtlThaSyFQc=; b=bB7OjaB0ajVKsADi17MDpFcg1iYl11Psr6P1uQ/ckI3QFrGxa9fdnWsbCDQjhM0Nfw63Xl S3kyMKwIkYXzq1FtuFdlJ6PWQfDBDHZbkxZqsn1UBlJ1SCZvmniObPgIPgnGX6ytoofO5j gro4fAf1db6XSgPREmNkGC5O6/2NUwg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=oPsrUIn+; dmarc=none; spf=none (imf18.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690991318; a=rsa-sha256; cv=none; b=healxkYHHbqNokDGdOSZznkVuR8GKveSU1vxJxpYsb6mkUP8xaz349hX09msNHCKUbzfbP UtXlLjeh8cl5Em0/F9RebcfYUUG/n337JEnXHac5WOH+FZSEayCFo3WbLV7gHuBF8N2JqV D5Cba9q26fCgpLFyIswhlXY5t+/nlM8= 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-Rspamd-Queue-Id: 8777F1C0018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: g7p8quj8t1d3pmgwsm1scjgzyxm6o5ec X-HE-Tag: 1690991316-431024 X-HE-Meta: U2FsdGVkX18be/ps7qEDX7IFVHh0Aj8pOb8/sOyk57OiSExI74l+M72lz7T65SPkaZueDqNicgospN2zXu9A59/89+3gAw9e4usNlyTjxBm60FH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OMWU5WWWgoKcucjMx4rBZpqtLvANk+Sdi4iZMlqUI/a/3g7Lubdn X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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!