From: "Jiayuan Chen" <jiayuan.chen@linux.dev>
To: "Shakeel Butt" <shakeel.butt@linux.dev>
Cc: linux-mm@kvack.org, "Jiayuan Chen" <jiayuan.chen@shopee.com>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Muchun Song" <muchun.song@linux.dev>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@kernel.org>,
"Qi Zheng" <zhengqi.arch@bytedance.com>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Axel Rasmussen" <axelrasmussen@google.com>,
"Yuanchu Xie" <yuanchu@google.com>, "Wei Xu" <weixugc@google.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
"Hui Zhu" <hui.zhu@linux.dev>
Subject: Re: [PATCH v2] mm/memcg: scale memory.high penalty based on refault recency
Date: Tue, 06 Jan 2026 03:14:29 +0000 [thread overview]
Message-ID: <d9ed02ebcf71057e42c808beb68f8eb489394750@linux.dev> (raw)
In-Reply-To: <qlzvksuvo22rrngdihyeepwhphretoenre3gvkako7kgsgw3sy@l775pvzorcdh>
January 6, 2026 at 01:08, "Shakeel Butt" <shakeel.butt@linux.dev mailto:shakeel.butt@linux.dev?to=%22Shakeel%20Butt%22%20%3Cshakeel.butt%40linux.dev%3E > wrote:
>
> +Hui Zhu
>
> Hi Jiayuan,
>
> On Mon, Dec 29, 2025 at 11:39:55AM +0800, Jiayuan Chen wrote:
>
> >
> > From: Jiayuan Chen <jiayuan.chen@shopee.com>
> >
> > Problem
> > -------
> > We observed an issue in production where a workload continuously
> > triggering memory.high also generates massive disk IO READ, causing
> > system-wide performance degradation.
> >
> > This happens because memory.high penalty is currently based solely on
> > the overage amount, not the actual impact of that overage:
> >
> > 1. A memcg over memory.high reclaiming cold/unused pages
> > → minimal system impact, light penalty is appropriate
> >
> > 2. A memcg over memory.high with hot pages being continuously
> > reclaimed and refaulted → severe IO pressure, needs heavy penalty
> >
> > Both cases receive identical penalties today. Users are forced to
> > combine memory.high with io.max as a workaround, but this is:
> > - The wrong abstraction level (memory policy shouldn't require IO tuning)
> > - Hard to configure correctly across different storage devices
> > - Unintuitive for users who only want memory control
> >
> Thanks for raising and reporting this use-case. Overall I am supportive
> of making memory.high more useful but instead of adding more more
> heuristic in the kernel, I would prefer to make the enforcement of
> memory.high more flexible with BPF.
>
> At the moment, Hui Zhu is working on adding BPF support for memcg but it
> is very generic and I would prefer to start with specific and real
> use-case. I think your use-case is real and will be beneficial to many
> other users. Can you please followup on that Hui's RFC to present your
> use-case? I will also try to push the effort from the review side.
>
> thanks,
> Shakeel
>
Hi Shakeel,
Thanks for the feedback and pointing to Hui's RFC.
I noticed Michal has already forwarded my patch to that thread, and
Hui has responded. I'll wait to see how that discussion evolves and
whether there's an opportunity to integrate my use-case into his
BPF framework.
You're right that my timestamp-based approach is heuristic. It was
designed as a simple, low-overhead approximation to detect active
thrashing without the cost of flushing refault counters on every
charge. But I agree that a more flexible BPF-based solution could
be cleaner in the long term.
I'll follow up on Hui's thread once there's more progress.
Thanks,
Jiayuan
prev parent reply other threads:[~2026-01-06 3:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251229033957.296257-1-jiayuan.chen@linux.dev>
2025-12-29 10:42 ` Markus Elfring
2025-12-30 11:37 ` Michal Koutný
2026-01-05 17:08 ` Shakeel Butt
2026-01-06 3:14 ` Jiayuan Chen [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=d9ed02ebcf71057e42c808beb68f8eb489394750@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=cgroups@vger.kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hui.zhu@linux.dev \
--cc=jiayuan.chen@shopee.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=yuanchu@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