Re: [PATCH v3 1/1] mm: let node_reclaim() return the number of pages reclaimed
From: Petr Tesarik
Date: Mon Jul 13 2026 - 08:58:04 EST
V Mon, 13 Jul 2026 07:04:43 -0400
Johannes Weiner <hannes@xxxxxxxxxxx> napsáno:
> On Fri, Jul 10, 2026 at 05:23:20PM +0200, Petr Tesarik wrote:
> > There is only one caller, get_page_from_freelist(), and it does not make
> > any use of the reason for skipping the reclaim, nor does it make any
> > distinction between a full and partially successful reclaim.
> >
> > Therefore, node_reclaim() can simply return the number of pages that have
> > been reclaimed, same as __node_reclaim(), and the NODE_RECLAIM_xxx macros
> > can be removed.
> >
> > There is one small change of behavior when __node_reclaim() was attempted
> > but returned zero. The allocation now skips the zone immediately; before
> > this patch, the zone watermarks were checked first. I believe it was an
> > oversight rather than intention, because the chances that zone watermark is
> > OK after __node_reclaim() did not reclaim any pages are very close to zero.
> >
> > Originally, I was looking for occurences of NODE_RECLAIM_SOME and
> > NODE_RECLAIM_SUCCESS, but I couldn't find any. That's because they are
> > typecast from the result of a relational operator. This seemed a bit
> > fragile, so I dug a bit deeper and came up with this proposed cleanup.
> >
> > Signed-off-by: Petr Tesarik <ptesarik@xxxxxxxx>
>
> Looks good to me, and agree with the minor change in behavior being
> acceptable. With the macros actually removed,
Uh-oh, I missed that hunk when rebasing, and of course, there's no
compiler warning about unused macros. :-(
> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
Thank you. Shall I resubmit once more to include the hunk that removes
the macros from mm/internal.h?
Petr T