Re: [PATCH v3 2/2] mm/mglru: fix ineffective memory protection for non-kswapd reclaim

From: Barry Song

Date: Thu Sep 03 2026 - 02:39:10 EST


On Thu, Sep 3, 2026 at 11:20 AM Ridong Chen <ridong.chen@xxxxxxxxx> wrote:
>
> From: Ridong Chen <chenridong@xxxxxxxxxx>
>
> For MGLRU, memory.min/low is not honored during global proactive reclaim
> (writing to the root memory.reclaim) and global direct reclaim, because
> these paths shrink memcgs using stale or effective protection (emin/elow).

Are you sure it should be “stale or effective”?
My gut feeling is that we don't need the “or” here.

[...]
>
> Fixes: e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
> ---

With a few nits:

Reviewed-by: Barry Song <baohua@xxxxxxxxxx>

[...]
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index b4c9b8f3dfe9..500cc2051d13 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -5111,7 +5111,13 @@ static int shrink_one(struct lruvec *lruvec, struct scan_control *sc)
> struct mem_cgroup *memcg = lruvec_memcg(lruvec);
> struct pglist_data *pgdat = lruvec_pgdat(lruvec);
>
> - /* lru_gen_age_node() called mem_cgroup_calculate_protection() */
> + /*
> + * For kswapd, lru_gen_age_node() has already called
> + * mem_cgroup_calculate_protection()
> + */

Could be clearer:

/*
* For kswapd, mem_cgroup_calculate_protection() has already
* been called during the top-down cgroup traversal.
*/

> + if (!current_is_kswapd())
> + mem_cgroup_calculate_protection_path(NULL, memcg);

Best Regards
Barry