From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057306; b=BqesMqGMbamovrYnFJFt5mfiY4YyaWJ/H1Nt2pXqfkCZTgxNA4OThgjo1Eb5d+KknZyr v8nxxsedQ+G+1F7QJDWnd7W9cBDTGCFA7oQdc49GeR52Hz0htyNNTTwxkQ5dvI8gPJvWl eGEvtnnmSN6Tv6KDRuvNt8NzQnZfdWlZgFRLPiso/63Jj1TaPxlcIS+pi26NJgOlIsmcx LN8Cqh4u3VqrdzkVslpa+/rp/L1OEccCZrhPpBr6FTBTpNRqy7dmGQsG9/7Z3OlTudn3V zn07WNT5KGz38qWdBHWI+qIWJ5JyB+Kt0S1QJik2p58cIY5eYu3hxwYmpm5J5RZTd0g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057306; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: 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=NrD2/nIOmEMzBE5ctdzCxPUQBS5WVxQzbtjmT6Pk0+3t2JIkI1HYjQJYV9wEdyfwN6dQ +TFc9j+Y9qO0MaFSIIR0i4ofJxgwmptZq+l27uw1rgfguQ9oqgt7tajmX3UwAX3s10Y5+ zWPnAk3usEiu5NO28rsntHZZcMitYHtnXnoifvch7oK+MqLNbE25esLpF0A52iwxMppS4 Vzs18f3D73aMZ4114K5ErL2cY2yeN/uN1D0ZlfpCBADxh1rqW+4u9htEeu3jLIsRq26F9 66wNobOsd6XWzGVGhyhPsRWrnVM1frByMUzHh/EoIlRuxg5V6CeQsMiocwvAkByurxA== 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.49 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 53EB5606A32C for ; Mon, 30 Nov 2026 16:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 53EB5606A32C 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-f49.google.com with SMTP id 46e09a7af769-847ac7ccd85so5950702a34.3 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=CvBZpe3g8Dtr0FsaNnZ+diym6EliPgjuz3FmhoPWPv/gN4rX4gNgpAY5IBkk5DzJjw srwkwCfrw8FccfPeYUNKuCLm65hlsZl6FT72kqNt+dRCcVHv/kkEOFytXecw4v59hfSP EUK2M+44R/8yfsAzvu1jQEBKTVUweKwkEw4lqTHvzLW8qdtYHXPNyi98Bxw/PXfrOtBB 0vtzogppLnGw1y5u8Vgq5wI9PFq75Qh3vi61MUV33XRgZ1z5lIWEZab0texMXWetCCX6 DptPbYlChzd1X5R0QC+Lu+h84RAHGmXLmtDFrPstXexLENukvJlHr/eLgaxiXEHIgMw0 /3lg== X-Gm-Message-State: APuU4Z+fyo7bKU2heatUdcYrVmin2xSWYZCX2hQMPQzd9B229n1G2RbV oTusdrzTQjOFbOU0v3SltiobIhTQFfMOr007bgALVFodEdM094hIq4yB X-Gm-Gg: AZFdTZdtKOVDfIr9z+++YAjI7wk1A8epypGD7DNiREtR8BwteVMMPvU8VLAScrsdMer YTgBgFE/PHxgXtmVQtzwuEVAfpn7AqWrnTLp5SiUhqWl3FOwRkLXonMj1V7ETQjxSBjK4nyjHAs ylw5EBCAxJ7QfGYBpYOEpI5cBfc4jeGZbfXr0kvsGmx0x6dY28nOMBVv1Am6j04DF0Yr5mhgHwm LMb+cFFldXnwfoCD+XodyajH3KO2hloWA/ARsSi38eRyJtrwFZUxyaWE0JCY/jgVovKLj33w+D5 JHAKZpjyls/3F3Ge0D2UXkWV37iTIAnnQ7K6Xqfaw/oEJ4vk/YganXam5kwJ4QyBkFyRuo/4sII KHNpGea1F32GEWKygLgvpUlItHQLcSznClYVgDTvkpzpxNHxB5wF6OZfWV1t+qlVdsRomm2EkrS DqMgnh+r0RhVC8qcC05/U4uuVetBUhyj0KZL73E7Ywmu0aDQpqyZP39fnFyyR/WuzQeOb3y1O+8 2zV1Wt4+sSYihPiRW8U5BYBqV7+5KmxpUh6xYnFlsF8/Oe28EzzmsEBBOQbReLoQlJVGgVWocUc CCM8Gz2gaHerhOJ3jzDT8NUK4LmLF/ePds/Cs9nx7T1S34cZGngfyFnQHi4FFPvBUm5nDT8/Rsi olR8Juw== 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-kernel@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 > >