linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Hao Jia <jiahao.kernel@gmail.com>
Cc: akpm@linux-foundation.org, yuzhao@google.com, yuanchu@google.com,
	 mhocko@kernel.org, lorenzo.stoakes@oracle.com,
	kinseyho@google.com,  hannes@cmpxchg.org, gthelen@google.com,
	david@redhat.com, axelrasmussen@google.com,
	 zhengqi.arch@bytedance.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,  Hao Jia <jiahao1@lixiang.com>
Subject: Re: [PATCH] mm/mglru: Update MG-LRU proactive reclaim statistics only to memcg
Date: Thu, 17 Jul 2025 12:47:32 -0700	[thread overview]
Message-ID: <z3n3dfpgrctgf3mlkqydmos2svh353v3qzd22n4g3iygji6rsr@4l4zgkrl5w35> (raw)
In-Reply-To: <20250717082845.34673-1-jiahao.kernel@gmail.com>

Hi Hao,

On Thu, Jul 17, 2025 at 04:28:45PM +0800, Hao Jia wrote:
> From: Hao Jia <jiahao1@lixiang.com>
> 
> Users can use /sys/kernel/debug/lru_gen to trigger proactive memory reclaim
> of a specified memcg.

Are you using this interface for proactively reclaiming a specific
memcg? I see run_cmd() using mem_cgroup_from_id() to get memcg from a
given id but I don't think we expose ids from mem_cgroup_ids to the
userspace. Usually we use cgroup_id which is just an inode number for
the cgroup folder. I wonder if the current users of this interface are
providing memcg id.

> Currently, statistics such as pgrefill, pgscan and
> pgsteal will be updated to the /proc/vmstat system memory statistics.
> 
> This will confuse some system memory pressure monitoring tools, making
> it difficult to determine whether pgscan and pgsteal are caused by
> system-level pressure or by proactive memory reclaim of some specific
> memory cgroup.
> 
> Therefore, make this interface behave similarly to memory.reclaim.
> Update proactive memory reclaim statistics only to its memory cgroup.
> 
> Signed-off-by: Hao Jia <jiahao1@lixiang.com>

The patch looks fine though.

> ---
>  mm/vmscan.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index f8dfd2864bbf..bc92ec338065 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -5545,6 +5545,7 @@ static int run_cmd(char cmd, int memcg_id, int nid, unsigned long seq,
>  	if (memcg_id != mem_cgroup_id(memcg))
>  		goto done;
>  
> +	sc->target_mem_cgroup = memcg;
>  	lruvec = get_lruvec(memcg, nid);
>  
>  	if (swappiness < MIN_SWAPPINESS)
> @@ -5581,6 +5582,7 @@ static ssize_t lru_gen_seq_write(struct file *file, const char __user *src,
>  		.may_swap = true,
>  		.reclaim_idx = MAX_NR_ZONES - 1,
>  		.gfp_mask = GFP_KERNEL,
> +		.proactive = true,
>  	};
>  
>  	buf = kvmalloc(len + 1, GFP_KERNEL);
> -- 
> 2.34.1
> 


  reply	other threads:[~2025-07-17 19:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  8:28 Hao Jia
2025-07-17 19:47 ` Shakeel Butt [this message]
2025-07-18  3:09   ` Hao Jia
2025-07-17 20:18 ` Yuanchu Xie
2025-07-18  3:30   ` Hao Jia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=z3n3dfpgrctgf3mlkqydmos2svh353v3qzd22n4g3iygji6rsr@4l4zgkrl5w35 \
    --to=shakeel.butt@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=david@redhat.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=jiahao.kernel@gmail.com \
    --cc=jiahao1@lixiang.com \
    --cc=kinseyho@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@kernel.org \
    --cc=yuanchu@google.com \
    --cc=yuzhao@google.com \
    --cc=zhengqi.arch@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox