From: Lance Yang <lance.yang@linux.dev>
To: Michal Hocko <mhocko@suse.com>, Leon Huang Fu <leon.huangfu@shopee.com>
Cc: linux-mm@kvack.org, hannes@cmpxchg.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev,
akpm@linux-foundation.org, joel.granados@kernel.org,
jack@suse.cz, laoar.shao@gmail.com, mclapinski@google.com,
kyle.meyer@hpe.com, corbet@lwn.net, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org
Subject: Re: [PATCH mm-new v2] mm/memcontrol: Flush stats when write stat file
Date: Wed, 5 Nov 2025 16:39:18 +0800 [thread overview]
Message-ID: <19986584-885b-4754-b98c-948e4bf9716b@linux.dev> (raw)
In-Reply-To: <aQsIq_zQXMfNNo6G@tiehlicka>
On 2025/11/5 16:19, Michal Hocko wrote:
> On Wed 05-11-25 15:49:16, Leon Huang Fu wrote:
>> diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
>> index 6eed14bff742..8cab6b52424b 100644
>> --- a/mm/memcontrol-v1.c
>> +++ b/mm/memcontrol-v1.c
>> @@ -2040,6 +2040,7 @@ struct cftype mem_cgroup_legacy_files[] = {
>> {
>> .name = "stat",
>> .seq_show = memory_stat_show,
>> + .write_u64 = memory_stat_write,
>> },
>> {
>> .name = "force_empty",
>> @@ -2078,6 +2079,7 @@ struct cftype mem_cgroup_legacy_files[] = {
>> {
>> .name = "numa_stat",
>> .seq_show = memcg_numa_stat_show,
>> + .write_u64 = memory_stat_write,
>> },
>
> Any reason you are not using .write like others? Also is there any
> reason why a specific value is required. /proc/sys/vm/stat_refresh which does
> something similar ignores the value. Also memcg.peak write handler which
> resets the peak value ignores it. It is true that a specific value
> allows for future extensions but I guess it would be better to be
> consistent with others here.
>
> One last thing to consider is whether this should follow
> /proc/sys/vm/stat_refresh path and have a single file to flush them all
> or have a per file flushing. I do not have a strong preference but
> considering both are doing the same thing it makes sense to go
> stat_refresh path.
+1
IMHO, a dedicated file like memory.stat_refresh is a much better approach ;)
It's cleaner, simpler to use, and much more intuitive for users.
>
> In any case, thanks for considering the explicit flushing path which is
> IMHO much better than flushing tunning which would become really hard
> for admins to wrap their heads around. Especially when dealing with
> large fleets of machines to maintain.
next prev parent reply other threads:[~2025-11-05 8:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 7:49 Leon Huang Fu
2025-11-05 8:19 ` Michal Hocko
2025-11-05 8:39 ` Lance Yang [this message]
2025-11-05 8:51 ` Leon Huang Fu
2025-11-06 1:19 ` Shakeel Butt
2025-11-06 3:30 ` Leon Huang Fu
2025-11-06 5:35 ` JP Kobryn
2025-11-06 6:42 ` Leon Huang Fu
2025-11-06 23:55 ` Shakeel Butt
2025-11-10 6:37 ` Leon Huang Fu
2025-11-10 20:19 ` Yosry Ahmed
2025-11-06 17:02 ` JP Kobryn
2025-11-10 6:20 ` Leon Huang Fu
2025-11-10 19:24 ` JP Kobryn
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=19986584-885b-4754-b98c-948e4bf9716b@linux.dev \
--to=lance.yang@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=joel.granados@kernel.org \
--cc=kyle.meyer@hpe.com \
--cc=laoar.shao@gmail.com \
--cc=leon.huangfu@shopee.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mclapinski@google.com \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
/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