Re: [PATCH] disable demotion during memory reclamation
From: Andrew Morton
Date: Mon Sep 08 2025 - 21:36:57 EST
On Tue, 9 Sep 2025 09:21:41 +0800 cuishiwei <cuishw@xxxxxxxxxx> wrote:
> When a memory cgroup exceeds its memory limit, the system reclaims
> its cold memory.However, if /sys/kernel/mm/numa/demotion_enabled is
> set to 1, memory on fast memory nodes will also be demoted to slow
> memory nodes.
>
> This demotion contradicts the goal of reclaiming cold memory within
> the memcg.At this point, demoting cold memory from fast to slow nodes
> is pointless;it doesn't reduce the memcg's memory usage. Therefore,
> we should set no_demotion when reclaiming memory in a memcg.
Is this from code inspection? Or is there some workload which benefits
from this change? If the latter, please tell us all about it.
>
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -6706,6 +6706,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
> .may_unmap = 1,
> .may_swap = !!(reclaim_options & MEMCG_RECLAIM_MAY_SWAP),
> .proactive = !!(reclaim_options & MEMCG_RECLAIM_PROACTIVE),
> + .no_demotion = 1,
> };
> /*
> * Traverse the ZONELIST_FALLBACK zonelist of the current node to put
> --
> 2.43.0