From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057306; b=DIBVF77sIYR1SWL2Mq0tlwSdFDOUaPeIaH49fkiTZRffRthuZR2Sg4CnGIVGxnTL1qVl OK/pFPEltsjNayOBiWWOzFim0IFekm36bIdUV7fuq2IDUKvDrXhO5Js+v/XchWrj+NJ0i zLzrJnapXjhoizhD36WReELmXsm+rL76E1h6g7bnh9grb4cwTtnWOJGk3SUiTcpFHNBGH 8XJNq4pwKDlDr9KsSkuIR8xtB+1xgMGlu+HF+57IeyAdEntN1nl53yDqkJhm5x7SfTt6t DHdMDwX3oMD+rklNUa/4EoCjMb1UOxzp5voTOkIS+B9FmoN4MfMBT0xIIUYw66yEkcw== 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-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=fLGemQU25LyuQ66JNuyJalKmVslFPkV6P0GFsba6/lf4MpN9k9/JF6L6RrW/hJbTPYTD IGiQjJfV6gf5jdelbxx5Pg8fMYM0D6sInUnbYW98FUdzdqQf/kBt3iBofDE6zI/q1HUd6 zHRgdZVkKLMKUdyWL4/eZ9M7ISYvKTIzz9cfo5sJJMOSrIQv73p7pxgHju8olbds7iFBm EL6R3HFslhNH5T74v16Vl8FYmOSi7xVVXkpk5TyEU5AXNGYLTJVrrxWbtAU1TSgbSxm5u vttzbfCKCgN5IBoezc3tc3FxFwcPHCG+BEd5qCQbjJwBdryXgjdsgyws/Jz8LhJL0ew== 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.167.181 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (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 73925606A31C for ; Mon, 30 Nov 2026 16:48:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 73925606A31C 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-oi1-f181.google.com with SMTP id 5614622812f47-4af81963f35so7642033b6e.0 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=vcT8pToxFxOt2aGxCzPK39KfQPqc9Su+zwjraBPQfHeAs/uvnwW5C4OtSMyZC1eBb/ QuZXfOD9RKLEv78KTJR17s85YhPbCHnV5xZ55BAeKdxVNDyxqDsPj3XW7iXgDsZ/n5aS 5DufCYJjCyLERDEwdkpYThjJ12/iCj9+J3gbXSgFRpnAAq72CRQAjvQnuGVjnaic20K0 ObBtUCvG8TvBot7qU1Vyevi9zEAkYo6YjUWxV/KZ2vvRVGDcgE5CarnFQQTJId3Yur+0 ljfX7PcJoz8OiUKQ/3pIQ3TaVC9RcJkVnCs2VWnMYxEkiityi2GRnYW33LXUC1+Nraew 3KAg== X-Forwarded-Encrypted: i=1; AL+hErH/faYcBJrIKyiDjx+uPxy4e+8uGUedH6PvaUrlZwEpES6JOii21JbIwLi0au7e+u7op5kgvFldXa11@vger.kernel.org X-Gm-Message-State: APuU4Z9EP5Z86W5UWeK52sRnAWAksE917ZlCgv9Ue0sZKRQFpazspOvI euQLTz50JtNTYHvxXFi20725E3LIZfQBSxB6NlMQvfmo0PGjv/5FuJzs X-Gm-Gg: AZFdTZeKSQ8+LotafUxosiVDqqCJ5rw6tC09yfdIGwPdGGkoy3Q80ba2i/q9mB2QLj9 dAirxf7Lem1S3nHBtv9kD5QrJhK/7MylfkFXDtTMbeCbzugFMyknanx5Dhz266fIHBCaH6y13vD 2CMt0ztaPde6tMhoyWk9RvQd5so21jskonGyfKEdd39SFgHljwMjiEAZV/Liix2zxiQlPwYL8Ic BsMNa2tXyugGRCbgH6/vj5YLbjHOuQkaMj5KHxahnIORt2XLjGxTxtKZy7ptofzH+88e59gdu6e QgDwhteIEQ4yGuUge8RfXuVQee1Fogx2F3zS80JIfA5co93tv6RD4l2PR/wKLXfJGNt8UeZWk4z yddSlKrkgqWyRMSmnWKyzHMw6UWd05HEB+BCxd1RH6CvmyGrpKS7tcOVJU13SDTna75X1JYQCoH iLdJ/ENCnsuSyMfzVXm0unTmkCCvdQSWqdRg2+FFJjTjKGGipvaDXBSxyMN9wNsdudENOdjO+61 gVarFkGYvG0wCTFesyittkTsBBslW1cbxQ5BQn6xDuXVmwaXfo08bpAKnyEiRAPCWm/yUPFiOD7 dE2UvvYBOd++OxdG8a0Lr8TJZcUeCpyotb6imgLBB2vtJqKFS7qD5F3TfwL2/kzKHUdzeJt5mUs Qs5x/tA== 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-acpi@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 > >