Re: [PATCH v3 1/1] mm: let node_reclaim() return the number of pages reclaimed

From: Zi Yan

Date: Mon Jul 13 2026 - 15:31:50 EST


On Fri Jul 10, 2026 at 11:23 AM EDT, 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>
>
> --
>
> Changes from v2:
> - remove the enum and return the number of pages reclaimed
>
> Changes from v1:
> - use an enum instead of a bool
> ---
> mm/internal.h | 9 +++++----
> mm/page_alloc.c | 19 ++++---------------
> mm/vmscan.c | 16 ++++++++--------
> 3 files changed, 17 insertions(+), 27 deletions(-)
>
With the macro removed, feel free to add

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>


--
Best Regards,
Yan, Zi