From: "Brendan Jackman" <brendan.jackman@linux.dev>
To: "Petr Tesarik" <ptesarik@suse.com>,
"Brendan Jackman" <brendan.jackman@linux.dev>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@kernel.org>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Michal Hocko" <mhocko@suse.com>, <linux-mm@kvack.org>,
"Brendan Jackman" <jackmanb@google.com>,
"Johannes Weiner" <hannes@cmpxchg.org>, "Zi Yan" <ziy@nvidia.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] mm: reduce NODE_RECLAIM_xxx and change to enum
Date: Fri, 12 Jun 2026 14:28:40 +0000 [thread overview]
Message-ID: <DJ7549TJF9I5.O3K9X2TP8VE1@linux.dev> (raw)
In-Reply-To: <20260612133155.71958e80@mordecai>
On Fri Jun 12, 2026 at 11:31 AM UTC, Petr Tesarik wrote:
>> >
>> > - NODE_RECLAIM_NOSCAN -> NODE_RECLAIM_NONE
>> > - NODE_RECLAIM_FULL -> NODE_RECLAIM_NONE
>> > - NODE_RECLAIM_SOME -> NODE_RECLAIM_SUCCESS
>> > - NODE_RECLAIM_SUCCESS -> NODE_RECLAIM_SUCCESS
>> > --- a/mm/internal.h
>> > +++ b/mm/internal.h
>> > @@ -1373,23 +1373,24 @@ static inline void mminit_verify_zonelist(void)
>> > }
>> > #endif /* CONFIG_DEBUG_MEMORY_INIT */
>> >
>> > -#define NODE_RECLAIM_NOSCAN -2
>> > -#define NODE_RECLAIM_FULL -1
>> > -#define NODE_RECLAIM_SOME 0
>> > -#define NODE_RECLAIM_SUCCESS 1
>> > +enum node_reclaim {
>> > + NODE_RECLAIM_NONE,
>> > + NODE_RECLAIM_SUCCESS,
>> > +};
>> > - ret = __node_reclaim(pgdat, gfp_mask, nr_pages, &sc) >= nr_pages;
>> > + nr_reclaimed = __node_reclaim(pgdat, gfp_mask, nr_pages, &sc);
>> > clear_bit_unlock(PGDAT_RECLAIM_LOCKED, &pgdat->flags);
>> >
>> > - if (ret)
>> > + if (nr_reclaimed >= nr_pages)
>> > count_vm_event(PGSCAN_ZONE_RECLAIM_SUCCESS);
>> > else
>> > count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED);
>> >
>> > - return ret;
>> > + return NODE_RECLAIM_SUCCESS;
>>
>> Should that be returning NODE_RECLAIM_NONE when !ret?
>
> No. That's the thing. Before my patch, the return value here was either
> NODE_RECLAIM_SUCCESS (when at least nr_pages were reclaimed), or
> NODE_RECLAIM_SOME (if less than nr_pages were reclaimed), but the caller
> makes no distinction, handling both cases in the default label of a
> switch statement.
Agh! Sorry. It's good that you are cleaning this up :D
So in that case my question is: is it intended that we call
zone_watermark_ok() in the case that we reclaimed 0 pages?
If not, maybe what we want here is:
- One patch to stop doing that.
- Another patch to switch over to the enum.
And then it _would_ return NODE_RECLAIM_NONE when !ret?
Have a weird feeling I'm still being stupid here, let's see...
next prev parent reply other threads:[~2026-06-12 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 8:50 [PATCH v2 1/1] mm: reduce NODE_RECLAIM_xxx and change to enum Petr Tesarik
2026-06-12 10:10 ` Brendan Jackman
2026-06-12 11:31 ` Petr Tesarik
2026-06-12 14:28 ` Brendan Jackman [this message]
2026-06-12 15:01 ` Zi Yan
2026-06-12 15:10 ` Brendan Jackman
2026-06-12 15:17 ` Zi Yan
2026-06-12 14:57 ` David Hildenbrand (Arm)
2026-06-12 15:10 ` Petr Tesarik
2026-06-12 14:57 ` Zi Yan
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=DJ7549TJF9I5.O3K9X2TP8VE1@linux.dev \
--to=brendan.jackman@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=ptesarik@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--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