Re: [PATCH v2 1/1] mm: reduce NODE_RECLAIM_xxx and change to enum
From: Petr Tesarik
Date: Fri Jun 12 2026 - 11:11:00 EST
On Fri, 12 Jun 2026 16:57:08 +0200
"David Hildenbrand (Arm)" <david@xxxxxxxxxx> wrote:
> On 6/12/26 10:50, Petr Tesarik wrote:
> > Change node_reclaim() to return an enum indicating whether any
> > pages have been reclaimed, because that's all the information
> > needed by the only caller, get_page_from_freelist().
> >
> > This leads to the following translation of the old macro
> > identifiers to the new enum values:
> >
> > - NODE_RECLAIM_NOSCAN -> NODE_RECLAIM_NONE
> > - NODE_RECLAIM_FULL -> NODE_RECLAIM_NONE
> > - NODE_RECLAIM_SOME -> NODE_RECLAIM_SUCCESS
> > - NODE_RECLAIM_SUCCESS -> NODE_RECLAIM_SUCCESS
>
> Why not simply return the number of reclaimed pages (0 vs > 0)? I agree that a
> bool is not good.
>
> Or if that is not good enough (for some reason) return 0 (success) vs. -ENOENT?
I don't have a strong opinion, except I hate the current code. ;-)
If we can agree that get_page_from_freelist() need not recheck with
zone_watermark_ok() after __node_reclaim() returns zero, then I believe
the cleanest option is to return the number of pages (zero if reclaim
was not even attempted).
Petr T