Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	David Hildenbrand <david@kernel.org>,
	Gregory Price <gourry@gourry.net>, Zi Yan <ziy@nvidia.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Rakie Kim <rakie.kim@sk.com>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Kairui Song <kasong@tencent.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Peter Zijlstra <peterz@infradead.org>,
	Mel Gorman <mgorman@suse.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-mips@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-block@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	"Liam R. Howlett" <liam@infradead.org>,
	Axel Rasmussen <axelrasmussen@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Baoquan He <baoquan.he@linux.dev>, Barry Song <baohua@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Lorenzo Stoakes <ljs@kernel.org>, Michal Hocko <mhocko@suse.com>,
	Mike Rapoport <rppt@kernel.org>, Qi Zheng <qi.zheng@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@kernel.org>, Wei Xu <weixugc@google.com>,
	Yuanchu Xie <yuanchu@google.com>,
	Yury Norov <yury.norov@gmail.com>
Subject: Re: [PATCH 00/11] nodemask: switch to runtime nr_node_ids
Date: Tue, 1 Dec 2026 13:52:48 -0500	[thread overview]
Message-ID: <aw8XThqaTZg_yJWR@yury> (raw)
In-Reply-To: <awyhjqBjtnHdsNby@yury>

[-- Attachment #1: Type: text/plain, Size: 3324 bytes --]

On Sun, Nov 29, 2026 at 05:05:02PM -0500, Yury Norov wrote:
> On Sat, Nov 28, 2026 at 08:20:10PM -0800, Andrew Morton wrote:
> > On Sat, 28 Nov 2026 22:01:46 -0500 Yury Norov <ynorov@nvidia.com> wrote:
> > 
> > > I would suggest another experiment. Let's on the system boot print a
> > > message like:
> > > 
> > >     The kernel is configured to support for up to 1024 NUMA nodes, while
> > >     the actual number of nodes on this system is 2. This leaves 99.8% of
> > >     the allocated resources unused. Please consider reconfiguring.
> > > 
> > > We can show it, say, at 90% rate or higher, and wait until this will start
> > > showing up in the people's boot logs. :)
> > 
> > I love it - you're a troll after my own heart.
> > 
> > I guess we could try it as a standalone thing with lots of convincing
> > justifications.  Are you able to estimate the cost of these wasted
> > resources?
> 
> Yes, let me think about it for a few days, and I'll figure something
> out.
>  
> > otoh, I'm sure our downstream have considered all this and have good
> > reasons for these configurations so we should find out what those
> > reasons are before adding shouty things to dmesg,
>  
> I agree with Linus' comment on this.
> 
> > ditto NR_CPUS?
> > 
> > Who                         NR_CPUS
> > Mainline default                  64
> > RHEL                           8192
> > SUSE                           8192
> > Oracle UEK                     8192
> > Ubuntu                         8192
> > Debian                         8192
> > Fedora                         8192
> > AWS (Amazon Linux)             8192
> > Google (COS)                    512
> > Microsoft (Azure Linux)        8192
> > Meta                        unknown
> > Tencent (CubeSandbox)           128
> > 
> > Seems that as long as the machine gets nr_cpu_ids reasonably correct,
> > the main cost here is one bit/cpu in the task_struct: 1k.  Which is not
> > insignificant.
> 
> In aec6487e994d2, Ingo says each supported CPU eats ~8KB. It's 10 years
> old measurements, though. I'll recalculate it myself.
> 
> I think, the best solution for distros would be providing whatever
> kernel they want (but please better than now), then once loaded build
> it against localmodconfig, or similar. 

Hi Andrew, all,

So, I poked my AI, and ran some build bots, and the result is
summarized in the attached html. The key findings are:

set_mempolicy(MPOL_BIND) is 5% faster with this series for MAXSMP.

Compile-time costs:

 - MAXSMP costs is ~3.5K on baseline kernel;
 - each CPU costs ~150B;
 - each node costs 1.2-2.2KiB;
 - This series saves ~8K for MAXSMP vs baseline kernel;

Runtime costs on my local 8-cpu, 1-node machine with ~2K tasks, MAXSMP enabled:

 - Total memory consumed by nodemask and cpumask:       4.2  MB
 - Total memory if MAX_NUMNODES == 1 and NR_CPUS == 8:  53.1 KB
 - Reduction: 98.8%

Performance: MAXSMP vs 1 cpu x 1 node

Baseline:
 - cpumasks basic ops are 3-10x slower;
 - nodemask basic ops are 10-32x slower;

This series:

 - cpumasks basic ops are 3-10x slower;
 - nodemasks basic ops are 3-10x slower;

Before/after:
 - cpumasks: no significant change;
 - nodemasks: 70-75% faster;

setall and complement ops show performance degradation for some
configs - both for cpumasks and nodemasks; need to investigate.

Thanks,
Yury

[-- Attachment #2: nodemask-grid.html --]
[-- Type: text/html, Size: 1113062 bytes --]

  reply	other threads:[~2026-12-01 18:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 23:01 [PATCH 00/11] nodemask: switch to runtime nr_node_ids Yury Norov
2026-11-27 23:01 ` [PATCH 01/11] nodemask: add 'small' and 'large' compile-time sizes Yury Norov
2026-12-01 10:01   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 02/11] nodemask: pass nodemask length to node search functions Yury Norov
2026-12-01 10:02   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 03/11] mm/mempolicy: reject migrate_pages source IDs beyond nr_node_ids Yury Norov
2026-11-30 19:44   ` Gregory Price (Meta)
2026-12-01 10:02     ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 04/11] mm/mempolicy: preserve full-width userspace nodemasks Yury Norov
2026-12-01 10:10   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 05/11] mm: switch to runtime nodemask length Yury Norov
2026-12-01  9:57   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 06/11] MIPS: IP27: switch nmi_dump " Yury Norov
2026-12-01  9:58   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 07/11] ACPI: NUMA: switch acpi_map_pxm_to_node " Yury Norov
2026-12-01  9:58   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 08/11] mtip32xx: switch next_online_node() " Yury Norov
2026-12-01  9:58   ` David Hildenbrand (Arm)
2026-11-27 23:01 ` [PATCH 09/11] nodemask: add nodes_copy_and_extend() Yury Norov
2026-11-27 23:01 ` [PATCH 10/11] sched/numa: bound cpuset trace masks by nr_node_ids Yury Norov
2026-11-28 23:02   ` sashiko-bot
2026-11-30 16:30     ` Yury Norov
2026-11-27 23:01 ` [PATCH 11/11] nodemask: add cpumask-style operation size bounds Yury Norov
2026-11-30 19:59   ` Gregory Price (Meta)
2026-11-28 23:40 ` [PATCH 00/11] nodemask: switch to runtime nr_node_ids Andrew Morton
2026-11-29  3:01   ` Yury Norov
2026-11-29  4:20     ` Andrew Morton
2026-11-29  4:21       ` Linus Torvalds
2026-11-29 22:05       ` Yury Norov
2026-12-01 18:52         ` Yury Norov [this message]
2026-12-01 14:51       ` Gregory Price (Meta)
2026-12-01 15:03         ` Lorenzo Stoakes (ARM)
2026-11-30 11:51 ` Lorenzo Stoakes (ARM)
2026-11-30 12:17   ` David Hildenbrand (Arm)
2026-11-30 16:32     ` Yury Norov
2026-11-30 16:42       ` Lorenzo Stoakes (ARM)
2026-11-30 17:28         ` Yury Norov
2026-11-30 12:20   ` Lorenzo Stoakes (ARM)
2026-11-30 16:48 ` Joshua Hahn
2026-11-30 19:18   ` Joshua Hahn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw8XThqaTZg_yJWR@yury \
    --to=ynorov@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kasong@tencent.com \
    --cc=lenb@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=ljs@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterz@infradead.org \
    --cc=qi.zheng@linux.dev \
    --cc=rafael@kernel.org \
    --cc=rakie.kim@sk.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=ying.huang@linux.alibaba.com \
    --cc=yuanchu@google.com \
    --cc=yury.norov@gmail.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox