* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
@ 2026-10-19 20:14 ` Barry Song
2026-10-19 20:16 ` Johannes Weiner
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Barry Song @ 2026-10-19 20:14 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, axelrasmussen, yuanchu, weixugc, baoquan.he,
baolin.wang, hannes, david, mhocko, ljs, dave, roman.gushchin,
stable
On Tue, Oct 20, 2026 at 2:50 AM Gregory Price (Meta) <gourry@gourry.net> 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
Makes a lot of sense to me.
Reviewed-by: Barry Song <baohua@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
2026-10-19 20:14 ` Barry Song
@ 2026-10-19 20:16 ` Johannes Weiner
2026-10-19 20:51 ` Harry Yoo
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Johannes Weiner @ 2026-10-19 20:16 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, david, mhocko, ljs, dave,
roman.gushchin, stable
On Mon, Oct 19, 2026 at 02:50:02PM -0400, 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
2026-10-19 20:14 ` Barry Song
2026-10-19 20:16 ` Johannes Weiner
@ 2026-10-19 20:51 ` Harry Yoo
2026-10-19 22:06 ` Shakeel Butt
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harry Yoo @ 2026-10-19 20:51 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs, dave,
roman.gushchin, stable
On Mon, Oct 19, 2026 at 02:50:02PM -0400, 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
Looks good to me,
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
--
Cheers,
Harry / Hyeonggon
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (2 preceding siblings ...)
2026-10-19 20:51 ` Harry Yoo
@ 2026-10-19 22:06 ` Shakeel Butt
2026-10-19 22:52 ` Yosry Ahmed
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shakeel Butt @ 2026-10-19 22:06 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
baohua, axelrasmussen, yuanchu, weixugc, baoquan.he, baolin.wang,
hannes, david, mhocko, ljs, dave, roman.gushchin, stable
On Mon, Oct 19, 2026 at 02:50:02PM -0400, 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (3 preceding siblings ...)
2026-10-19 22:06 ` Shakeel Butt
@ 2026-10-19 22:52 ` Yosry Ahmed
2026-10-20 0:36 ` SJ Park
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Yosry Ahmed @ 2026-10-19 22:52 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs, dave,
roman.gushchin, stable
On Mon, Oct 19, 2026 at 02:50:02PM -0400, 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Yosry Ahmed <yosry@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (4 preceding siblings ...)
2026-10-19 22:52 ` Yosry Ahmed
@ 2026-10-20 0:36 ` SJ Park
2026-10-20 1:49 ` Balbir Singh
` (3 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: SJ Park @ 2026-10-20 0:36 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: SJ Park, linux-mm, linux-kernel, kernel-team, akpm, kasong,
qi.zheng, shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs, dave,
roman.gushchin, stable
On Mon, 19 Oct 2026 14:50:02 -0400 "Gregory Price (Meta)" <gourry@gourry.net> 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.
Both the issue description and the fix make sense to me.
>
> Fixes: b980077899ea4 ("mm: introduce per-node proactive reclaim interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: SJ Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (5 preceding siblings ...)
2026-10-20 0:36 ` SJ Park
@ 2026-10-20 1:49 ` Balbir Singh
2026-10-20 3:04 ` Gregory Price
2026-10-20 7:49 ` Michal Hocko
` (2 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Balbir Singh @ 2026-10-20 1:49 UTC (permalink / raw)
To: Gregory Price (Meta), linux-mm
Cc: linux-kernel, kernel-team, akpm, kasong, qi.zheng, shakeel.butt,
baohua, axelrasmussen, yuanchu, weixugc, baoquan.he, baolin.wang,
hannes, david, mhocko, ljs, dave, roman.gushchin, stable
On 10/20/26 5:50 AM, 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
> 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,
I just noticed some other issues with this code, in terms of honouring
zone_reclaim_node (not related to this patch). I'll send out fixes, for
this patch.
Reviewed-by: Balbir Singh <balbirs@nvidia.com>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-20 1:49 ` Balbir Singh
@ 2026-10-20 3:04 ` Gregory Price
0 siblings, 0 replies; 14+ messages in thread
From: Gregory Price @ 2026-10-20 3:04 UTC (permalink / raw)
To: Balbir Singh
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs, dave,
roman.gushchin, stable
On Tue, Oct 20, 2026 at 12:49:37PM +1100, Balbir Singh wrote:
> > 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,
>
>
> I just noticed some other issues with this code, in terms of honouring
> zone_reclaim_node (not related to this patch). I'll send out fixes, for
> this patch.
I'm shocked, I tell you, shocked!
These are all things I accidentally ran into by just uh... using the
interface. I'm absolutely positive these interfaces are full of bugs.
~Gregory
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (6 preceding siblings ...)
2026-10-20 1:49 ` Balbir Singh
@ 2026-10-20 7:49 ` Michal Hocko
2026-10-20 19:58 ` Gregory Price (Meta)
2026-10-20 15:19 ` Kunwu Chan
2026-10-20 16:59 ` Davidlohr Bueso
9 siblings, 1 reply; 14+ messages in thread
From: Michal Hocko @ 2026-10-20 7:49 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, ljs, dave,
roman.gushchin, stable
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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-20 7:49 ` Michal Hocko
@ 2026-10-20 19:58 ` Gregory Price (Meta)
2026-10-20 20:35 ` Michal Hocko
0 siblings, 1 reply; 14+ messages in thread
From: Gregory Price (Meta) @ 2026-10-20 19:58 UTC (permalink / raw)
To: Michal Hocko
Cc: Gregory Price (Meta),
linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, ljs, dave,
roman.gushchin, stable
On 2026-10-20 09:49 +0200, Michal Hocko wrote:
>
> 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.
funny enough, try_to_free_mem_cgroup_pages does what my patch does:
struct scan_control sc = {
.reclaim_idx = MAX_NR_ZONES - 1,
now, whether the gfp_mask should be GFP_KERNEL, that's a different
question i think.
(tl;dr i think my patch is still correct)
~Gregory
--
Gregory Price (Meta) <gourry@gourry.net>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-20 19:58 ` Gregory Price (Meta)
@ 2026-10-20 20:35 ` Michal Hocko
0 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2026-10-20 20:35 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, ljs, dave,
roman.gushchin, stable
On Tue 20-10-26 15:58:53, Gregory Price (Meta) wrote:
> On 2026-10-20 09:49 +0200, Michal Hocko wrote:
> >
> > 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.
>
> funny enough, try_to_free_mem_cgroup_pages does what my patch does:
>
> struct scan_control sc = {
> .reclaim_idx = MAX_NR_ZONES - 1,
>
>
> now, whether the gfp_mask should be GFP_KERNEL, that's a different
> question i think.
>
> (tl;dr i think my patch is still correct)
Ohh, right, I forgot that memcg reclaim always reclaims all zones.
Tweaking the mask seems more consistent but not something I will insist
on. Up to you which way to go. In any case
Acked-by: Michal Hocko <mhocko@suse.com>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (7 preceding siblings ...)
2026-10-20 7:49 ` Michal Hocko
@ 2026-10-20 15:19 ` Kunwu Chan
2026-10-20 16:59 ` Davidlohr Bueso
9 siblings, 0 replies; 14+ messages in thread
From: Kunwu Chan @ 2026-10-20 15:19 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: Kunwu Chan, linux-mm, linux-kernel, kernel-team, akpm, kasong,
qi.zheng, shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs, dave,
roman.gushchin, stable, Kunwu Chan
On Mon, 19 Oct 2026 14:50:02 -0400 "Gregory Price (Meta)" <gourry@gourry.net> 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@vger.kernel.org
> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
> ---
> 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,
> --
> 2.53.0-Meta
>
>
reclaim_idx = MAX_NR_ZONES - 1 is the right fix — proactive reclaim
isn't serving an allocation, so gfp_zone(GFP_KERNEL) needlessly caps
the scan. GFP_HIGHUSER_MOVABLE would also work for the node path
via gfp_zone(), but that's indirect.
Reviewed-by: Kunwu Chan <chentao@kylinos.cn>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim
2026-10-19 18:50 [PATCH] mm/vmscan: reclaim every zone in per-node proactive reclaim Gregory Price (Meta)
` (8 preceding siblings ...)
2026-10-20 15:19 ` Kunwu Chan
@ 2026-10-20 16:59 ` Davidlohr Bueso
9 siblings, 0 replies; 14+ messages in thread
From: Davidlohr Bueso @ 2026-10-20 16:59 UTC (permalink / raw)
To: Gregory Price (Meta)
Cc: linux-mm, linux-kernel, kernel-team, akpm, kasong, qi.zheng,
shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc,
baoquan.he, baolin.wang, hannes, david, mhocko, ljs,
roman.gushchin, stable
On Mon, 19 Oct 2026, 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@vger.kernel.org
>Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
This makes sense - sorry for the trouble but at least glad to see
people using this interface.
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
>---
> 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,
>--
>2.53.0-Meta
>
^ permalink raw reply [flat|nested] 14+ messages in thread