From: Mike Rapoport <rppt@kernel.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH 1/9] mm: numa_memblks: set numa_nodes_parsed in numa_add_memblk()
Date: Thu, 2 Jul 2026 18:54:04 +0300 [thread overview]
Message-ID: <akaJnPmqCvNQS8fY@kernel.org> (raw)
In-Reply-To: <CABFDxMF4B5cYYw5h+JWwBMFfz9XMVZMJdEwwy3ksRysYBTAZGw@mail.gmail.com>
On Thu, Jul 02, 2026 at 10:43:40PM +0900, Sang-Heon Jeon wrote:
> Hi, Mike
>
> On Thu, Jul 2, 2026 at 7:38 PM Mike Rapoport <rppt@kernel.org> wrote:
> >
> > > Every existing numa_add_memblk() caller separately marks the new node in
> > > numa_nodes_parsed with node_set(). Set the node in numa_add_memblk() itself
> > > on a successful add, so this no longer depends on each caller.
> > >
> > > numa_add_memblk_to() now returns -EINVAL for an out-of-range node id, so a
> > > zero return implies @nid was valid. No existing caller passes an
> > > invalid one, so existing callers are unaffected.
> > >
> > > The per-caller node_set() calls are removed in later patches.
> > >
> > > Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> > >
> > > diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c
> > > index 3c3c4eac3514..2d92ca38c02a 100644
> > > --- a/mm/numa_memblks.c
> > > +++ b/mm/numa_memblks.c
> > > @@ -135,14 +135,17 @@ EXPORT_SYMBOL(__node_distance);
> > > static int __init numa_add_memblk_to(int nid, u64 start, u64 end,
> > > struct numa_meminfo *mi)
> > > {
> > > - /* ignore zero length blks */
> > > - if (start == end)
> > > - return 0;
> > > -
> > > /* whine about and ignore invalid blks */
> > > - if (start > end || nid < 0 || nid >= MAX_NUMNODES) {
> > > + if (nid < 0 || nid >= MAX_NUMNODES) {
> > > pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n",
> > > nid, start, end - 1);
> > > + return -EINVAL;
> > > + }
> > > +
> > > + /* ignore zero length or invalid blks */
> > > + if (start >= end) {
> > > + pr_warn("Warning: invalid memblk node size %d [mem %#010Lx-%#010Lx]\n",
> > > + nid, start, end - 1);
> >
> > Nit: any reason to put this check here instead of replacing
> >
> > if (start == end)
> >
> > ?
>
> Reordering is needed to ensure the following node_set() is not called
> with an invalid nid.
> While doing that, I thought the start == end condition is the same
> kind of invalid blk, so I moved it into the warning block.
> But no strong opinion here though. Should I go back to not printing
> the warning for start == end in v2?
Yeah, please skip the warning in v2.
> > --
> > Sincerely yours,
> > Mike.
> >
>
> Best Regards,
> Sang-Heon Jeon
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-07-03 1:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 13:58 [PATCH 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
2026-06-28 13:58 ` [PATCH 1/9] mm: numa_memblks: set numa_nodes_parsed in numa_add_memblk() Sang-Heon Jeon
[not found] ` <178298867638.1436291.11279946475033863942.b4-review@b4>
[not found] ` <CABFDxMF4B5cYYw5h+JWwBMFfz9XMVZMJdEwwy3ksRysYBTAZGw@mail.gmail.com>
2026-07-02 15:54 ` Mike Rapoport [this message]
2026-06-28 13:58 ` [PATCH 7/9] mm: numa_memblks: remove redundant numa_nodemask_from_meminfo() Sang-Heon Jeon
2026-06-28 13:58 ` [PATCH 9/9] mm: numa_memblks: use numa_add_reserved_memblk() in numa_cleanup_meminfo() Sang-Heon Jeon
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=akaJnPmqCvNQS8fY@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ekffu200098@gmail.com \
--cc=linux-mm@kvack.org \
/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