From: Hao Jia <jiahao.kernel@gmail.com>
To: Yuanchu Xie <yuanchu@google.com>
Cc: akpm@linux-foundation.org, yuzhao@google.com,
shakeel.butt@linux.dev, 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: Fri, 18 Jul 2025 11:30:03 +0800 [thread overview]
Message-ID: <729aa946-7609-890a-3a13-4b0a58359aaa@gmail.com> (raw)
In-Reply-To: <CAJj2-QFNvw2dMQtpZt1nHjKYdJWCH_=w2=2RWLL6m__MBb6KpQ@mail.gmail.com>
On 2025/7/18 04:18, Yuanchu Xie wrote:
Hi Yuanchu,
> Hi Hao,
>
> On Thu, Jul 17, 2025 at 1:29 AM Hao Jia <jiahao.kernel@gmail.com> wrote:
>>
>> From: Hao Jia <jiahao1@lixiang.com>
>>
>> Users can use /sys/kernel/debug/lru_gen to trigger proactive memory reclaim
>> of a specified memcg. Currently, statistics such as pgrefill, pgscan and
>> pgsteal will be updated to the /proc/vmstat system memory statistics.
>
> This is a debugfs interface and it's not meant for use in production
> or provide a stable ABI. Does memory.reclaim not work for your needs?
>
No, I am comparing the two interfaces.
Thanks for your reminder, but I want to use this interface run_aging()
to age folios, and separate proactive memory reclamation from multiple
walk_mm() by combining it with BIT(LRU_GEN_MM_WALK).
For example, user-space agent, enable LRU_GEN_MM_WALK, and then trigger
run_aging(). Then turn off LRU_GEN_MM_WALK and use cgroup.reclaim to
trigger proactive reclamation. Avoid the long latency caused by walk_mm().
Maybe it would be more reasonable to put walk_mm() in workqueues?
I don't know if my idea is reasonable, any suggestions are welcome.
Thanks,
Hao
> I'm not against the change; I just hope you don't depend on it
> continuing to exist/behave a certain way.
>
> Shakeel's comment is accurate. The lru_gen interface uses the internal
> memcg id which is not usually used to interface with the userspace.
> Reading this file does show the cgroup path and memcg id association.
>
>>
>> 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 okay to me too.
>
> Thanks,
> Yuanchu
prev parent reply other threads:[~2025-07-18 3:30 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
2025-07-18 3:09 ` Hao Jia
2025-07-17 20:18 ` Yuanchu Xie
2025-07-18 3:30 ` Hao Jia [this message]
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=729aa946-7609-890a-3a13-4b0a58359aaa@gmail.com \
--to=jiahao.kernel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=david@redhat.com \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--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=shakeel.butt@linux.dev \
--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