[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251214154944.6a6e91ffb00677a5164074e9@linux-foundation.org>
Date: Sun, 14 Dec 2025 15:49:44 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Deepanshu Kartikey <kartikey406@...il.com>
Cc: axelrasmussen@...gle.com, yuanchu@...gle.com, weixugc@...gle.com,
hannes@...xchg.org, david@...nel.org, mhocko@...nel.org,
zhengqi.arch@...edance.com, shakeel.butt@...ux.dev,
lorenzo.stoakes@...cle.com, yuzhao@...gle.com, heftig@...hlinux.org,
oleksandr@...alenko.name, bgeffon@...gle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
syzbot+90fcab4d88cffed6d0d8@...kaller.appspotmail.com
Subject: Re: [PATCH] mm: vmscan: always allow writeback during memcg reclaim
On Sat, 13 Dec 2025 14:06:39 +0530 Deepanshu Kartikey <kartikey406@...il.com> wrote:
> When laptop_mode is enabled, may_writepage is set to 0 in
> try_to_free_mem_cgroup_pages(). This triggers a warning in MGLRU's
> lru_gen_shrink_lruvec():
>
> VM_WARN_ON_ONCE(!sc->may_writepage || !sc->may_unmap);
>
> The warning occurs because MGLRU expects full reclaim capabilities to
> function correctly. The call path is:
>
> mem_cgroup_resize_max()
> try_to_free_mem_cgroup_pages()
> do_try_to_free_pages()
> shrink_node()
> shrink_lruvec()
> lru_gen_shrink_lruvec() <-- WARNING
>
> Unlike kswapd or direct reclaim where laptop_mode's disk-saving behavior
> is a reasonable optimization, memcg limit enforcement is a hard
> requirement - memory MUST be freed when a cgroup exceeds its limit.
> The may_unmap field is already set unconditionally to 1 in this path,
> acknowledging that memcg reclaim needs full capabilities.
>
> Set may_writepage unconditionally to 1 for memcg reclaim to ensure
> MGLRU works correctly and memory limits are properly enforced.
>
Thanks, I'll add this to mm.git's mm-new branch for testing. I expect
a few days after that I'll quietly move it into the mm-unstable branch
where it will receive linux-next exposure. Further progress into
mm.git's non-rebasing for-next-merge-window mm-stable branch will
depend upon review outcomes.
Powered by blists - more mailing lists