Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
From: Michal Hocko
Date: Tue Oct 20 2026 - 03:50:04 EST
On Mon 19-10-26 14:50:02, Gregory Price (Meta) wrote:
> user_proactive_reclaim() limits per-node reclaim to
> gfp_zone(GFP_KERNEL), which is ZONE_NORMAL. Proactive reclaim serves no
> allocation, but that limit makes shrink_node() skip every ZONE_MOVABLE
> folio, so writing to /sys/devices/system/node/nodeN/reclaim never
> reclaims a node's movable memory. A movable-only node, such as dax/kmem
> or hotplugged memory onlined movable, reclaims nothing and fails with
> -EAGAIN.
>
> To reproduce, fill a movable-only node with clean page cache and write
> 200M to its nodeN/reclaim: the write fails with -EAGAIN and the page
> cache stays. The same write to a ZONE_NORMAL node frees 200MB.
>
> Scan every zone, as memory.reclaim does.
>
> Fixes: b980077899ea4 ("mm: introduce per-node proactive reclaim interface")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> ---
> mm/vmscan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index e82ba737c028d..90f7a7bf4e426 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -8180,7 +8180,7 @@ int user_proactive_reclaim(char *buf,
> } else {
> struct scan_control sc = {
> .gfp_mask = current_gfp_context(gfp_mask),
> - .reclaim_idx = gfp_zone(gfp_mask),
> + .reclaim_idx = MAX_NR_ZONES - 1,
> .proactive_swappiness = swappiness == -1 ? NULL : &swappiness,
> .priority = DEF_PRIORITY,
> .may_writepage = 1,
Would it make more sense to
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f11491ee9ed5..e07db9514e59 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7963,7 +7963,7 @@ int user_proactive_reclaim(char *buf,
int swappiness = -1;
char *old_buf, *start;
substring_t args[MAX_OPT_ARGS];
- gfp_t gfp_mask = GFP_KERNEL;
+ gfp_t gfp_mask = GFP_HIGHUSER_MOVABLE;
if (!buf || (!memcg && !pgdat) || (memcg && pgdat))
return -EINVAL;
That would take care of try_to_free_mem_cgroup_pages too.
--
Michal Hocko
SUSE Labs