From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057307; b=1Qp6KLF0YZ+QBxohJCIFqh5Vue5BEKo2q100I7x3IA7Tg6tqCAiSvdt0wzzVaFUWTGdh 9nXe5Y/RYdMHCTsP5fTbqHtb95d8vUuLDZxJ3rEf4p2gxQzUCNNur4u3i52VLIYvaAzeD 8AHWfJkf1mDxsx3ZMXc3GZKCrCxLzjVbPjEHonSPwKSjyKLiSDNkIQ3ew0JQ6ShokTS/g ahoiva1A6FFZJdENPmRhaEiwXYAichoatFzXUbuqfnIdxBEGZ6R7smBWukGQtoON5r0tU SqB3l7drko5vqzDb6iarg5jxr22Hx7Q4HzmaMRkOU73sc2iiC7cP/z0TlfeogT+ZPrA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057307; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=3vM0Ibb9B5+5rZNLG8AguoS6Ud8rB3eN7IxDxLTucMM=; b=i436IM6l/rXucQR4zKTZSHUTUTdPGTqskLwZvTBNLmYAu8fW9N+PXRCqFG2zUstvUSaN y4qRbZ+3GhaBKaxQbG5ANsa5oWSv9SG0S1euf0R/89E2hQDZVwcGpE91J2GrF5dTDal3V hgPAqAoPRLWceHevnKMhwHNmL26/xfjIhalyZN3+FXZj63FqbniYs0Kzu7Awdi565js/y KR8wvuYasZgk0A8p6eshEkunhyu5AFbTLwMgwD20rC3u1ZqKPixemVYpTiCWzJNVIQrr9 N4hxNzjDCxuROuQhcFlLn1PM57J7uAf65Fjg9Ni6s3WlTjIGsp3dg8UZwNbtwh0niSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0NfThiaK; arc=none smtp.remote-ip=209.85.210.50 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32721606A325 for ; Mon, 30 Nov 2026 16:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 32721606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0NfThiaK Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-844a8bf7e25so5949159a34.1 for ; Mon, 30 Nov 2026 08:48:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796057305; x=1796662105; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3vM0Ibb9B5+5rZNLG8AguoS6Ud8rB3eN7IxDxLTucMM=; b=0NfThiaK6dr4krpNlciB2KV3QyrqpTtZGVS5oAfsNyckGEq15iozNu4OGbC4qf+QtD wk3xF+9QthUl0FCbOvW1oq0mg8gWvF/2aJ5Shd/OV0I/yOD5cYAJ06rCKpRsv60ebDJ+ 6gPKp0xXtQb2JfTS1Fg8AcrMXQFRahPZuaQWdrkkazTHWanzvlhRXcHfpk6n44XcfXnV Jx9Ins9I+8NLRWZOqRmYjXDHbz5WKuc7haIrfYW0D9AIpRDr0V7/MLQYmxqoJ1ELAXWB SBU/iMhkeEWlgHk80W2cmj/SUGCOXo8ugjdntaQmu9rkli+J5hCPX9LlbFe4jfx9mUJF zrdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796057305; x=1796662105; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=3vM0Ibb9B5+5rZNLG8AguoS6Ud8rB3eN7IxDxLTucMM=; b=gs96vTBLOkqkSZA8TuTmxoTLgFqxYnIhV/lRpgujtFvfzM+Yjtb1f1MW/Wb3Dt8FOh 6N3wz2jiwa5W2rv+8HfPpkNRc0GPGo4tGifRqbZ6SIkie3oz3fIZo5P3dVf8+V7AVZd2 wS1NTRadOtTXpZMOOHbebXIUZQh2CJjciPePiwtjSb8MmCva+55YDJeKiGnh1HmJvFo5 /ZedTJNjv+HqZFGw+lwsGU0TcsZWHKx+4+AwBh8bFLnqcIWyxFsOsKAtfQrwjGeh8+L8 fbCq/Q/lBtuK6H2EmIooYEzQ/dsYKwh5sGn4kbqTxbnE1K7HRNm+ptcqdcpBKMHyMmnO Uymg== X-Forwarded-Encrypted: i=1; AL+hErGTo2inUMpubCknDEdh4MNPik79awcYhi7RXk9DzT70+wyG0P9jos5jfIk2Bu0SwbkFzDIlHQh2Mn8H@vger.kernel.org X-Gm-Message-State: APuU4Z+1bDN6guaHBw2Cw6l9818w0OxHP2qMXzyVb7QjHDyIAJzo354S fxhUJfEmOYY2usL2dJ+KA6Dm7Z31Lf13XUehgZkFq1ywa96AZ77k96wv X-Gm-Gg: AZFdTZePNNd8KjPHpil3s7ThxzC45tm/NipxyK4e5vlwPz6IkVGBeh2FY7y1779eq9O gjCZx9fm+UfuAkYfi44y39gA7O5X9JgNZofvvRTNE8RjX34SCB3owDX0PElKaX7IoZViSqXGVtS YlLicGPvrWhzZEd+bqjny/zG6fwWiQmyWP1i8l8IUAcpkby4mu5y5aNaTZSN9jFZcbpGHNVByNx +EYh7dQmU+Y4E5ZhmakWN3FU2nMMTNhl8jr7MUV9Qx1QG4rKKoaLGI3dgi6X/yJFvb1vjTb0Swp VqEp3SC7biT1PTWpeW0o2Du0b+tzaDg0yYdM5m99rtx45s6DvbKjVwLw9EwbUdMYXtfVEhN3QkA H9E7rY6yOw5zCKgFg0inBSwZ5cQIXymnESRAntGe6PrLzaBfkuoQ4b8a2xweyqkAPICJeqztvPu xmpeGia/Me/vuhOaO7abtQdyDCb7uqRXaTsJBWYRCPL0tLnyxM13f9gTET93GeIG7VFozaP1dk2 zw1a5bCyKE0IHebLsGlYRY4qK5mnYSXmdJyOj0LrvSJkzivN/o3SVPxhIDK9Qx7I/dpabL9oD5d O7uBFzSrm5mDDBZNGVf8+lZrVByK78ofaWrdFqrvApUtphyYQoiA01ObdF1vgEpW9H4FNm9CoW9 q92I8pA== X-Received: by 2002:a05:6808:4fca:b0:572:e0b1:18f4 with SMTP id 5614622812f47-57a0a405395mr36392452b6e.20.1796057305169; Mon, 30 Nov 2026 08:48:25 -0800 (PST) Received: from localhost ([2a03:2880:10ff:56::]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57a34252251sm26279822b6e.6.2026.11.30.08.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 08:48:24 -0800 (PST) Date: Mon, 30 Nov 2026 08:48:24 -0800 From: Joshua Hahn To: Yury Norov Cc: linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org, Rasmus Villemoes , David Hildenbrand , Gregory Price , Zi Yan , Rakie Kim , Ying Huang , Muchun Song , Oscar Salvador , Johannes Weiner , Kairui Song , Thomas Bogendoerfer , "Rafael J. Wysocki" , Len Brown , Jens Axboe , Peter Zijlstra , Mel Gorman , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-mips@vger.kernel.org, linux-acpi@vger.kernel.org, linux-block@vger.kernel.org, linux-trace-kernel@vger.kernel.org, "Liam R. Howlett" , Axel Rasmussen , Baolin Wang , Baoquan He , Barry Song , Linus Torvalds , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Qi Zheng , Shakeel Butt , Suren Baghdasaryan , Vlastimil Babka , Wei Xu , Yuanchu Xie , Yury Norov Subject: Re: [PATCH 00/11] nodemask: switch to runtime nr_node_ids Message-ID: Mail-Followup-To: Yury Norov , linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org, Rasmus Villemoes , David Hildenbrand , Gregory Price , Zi Yan , Rakie Kim , Ying Huang , Muchun Song , Oscar Salvador , Johannes Weiner , Kairui Song , Thomas Bogendoerfer , "Rafael J. Wysocki" , Len Brown , Jens Axboe , Peter Zijlstra , Mel Gorman , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-mips@vger.kernel.org, linux-acpi@vger.kernel.org, linux-block@vger.kernel.org, linux-trace-kernel@vger.kernel.org, "Liam R. Howlett" , Axel Rasmussen , Baolin Wang , Baoquan He , Barry Song , Linus Torvalds , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Qi Zheng , Shakeel Butt , Suren Baghdasaryan , Vlastimil Babka , Wei Xu , Yuanchu Xie , Yury Norov References: <20261127230128.111933-1-ynorov@nvidia.com> X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261127230128.111933-1-ynorov@nvidia.com> On Fri, Nov 27, 2026 at 06:01:17PM -0500, Yury Norov wrote: > Nodemasks have a compile-time capacity of MAX_NUMNODES, and > nr_node_ids describes the runtime node ID usage. > > Modern distros, like my Ubuntu, default MAX_NUMNODES to 1024, while the > actual number of nodes is typically smaller. All nodemask functions > currently refer to the MAX_NUMNODES, which adds a substantial overhead > on every traversing operation. > > This series switches the kernel to runtime length of nodemasks, which > also saves up to 8K of .text for minimal config, and accelerates basic > nodemask operations ~4x if MAX_NUMNODES == 1024 and nr_node_ids == 2. Hi Yury, Thanks for the series. I think it looks good and a 4x speedup on the nodemask operations is pretty awesome. I had a question that was a bit orthogonal to this series, I wanted your opinion on right-sizing MAX_NUMNODES. Something that's been bugging me is how much memory is wasted by statically allocating MAX_NUMNODES sized arrays, e.g: - mm/page_alloc.c: node_load[MAX_NUMNODES] - mm/mempolicy.c: preferred_node_policy[MAX_NUMNODES] - mm/hugetlb_cma.c: hugetlb_cma[MAX_NUMNODES] hugetlb_cma_size_in_node[MAX_NUMNODES] hugetlb_cma_percent_in_node[MAX_NUMNODES] ... etc ... In addition to the script to build the configs to match the local configs... I was wondering if you've thought about this side of the problem too. To be honest I'm not sure if there is much we can do, but I thought I would just bring it up : -) Thanks, Yury. As for the series I agree with Lorenzo, I think some additional context for the cover letter would help me think about these changes. Have a great day! Joshua > Yury Norov (11): > nodemask: add 'small' and 'large' compile-time sizes > nodemask: pass nodemask length to node search functions > mm/mempolicy: reject migrate_pages source IDs beyond nr_node_ids > mm/mempolicy: preserve full-width userspace nodemasks > mm: switch to runtime nodemask length > MIPS: IP27: switch nmi_dump to runtime nodemask length > ACPI: NUMA: switch acpi_map_pxm_to_node to runtime nodemask length > mtip32xx: switch next_online_node() to runtime nodemask length > nodemask: add nodes_copy_and_extend() > sched/numa: bound cpuset trace masks by nr_node_ids > nodemask: add cpumask-style operation size bounds > > arch/mips/sgi-ip27/ip27-nmi.c | 2 +- > drivers/acpi/numa/srat.c | 2 +- > drivers/block/mtip32xx/mtip32xx.c | 2 +- > include/linux/nodemask.h | 122 +++++++++++++++++++----------- > include/trace/events/sched.h | 7 +- > mm/hugetlb_internal.h | 2 +- > mm/mempolicy.c | 55 +++++++++----- > mm/mmzone.c | 2 +- > mm/vmscan.c | 2 +- > 9 files changed, 123 insertions(+), 73 deletions(-) > > -- > 2.53.0 > >