linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Deepanshu Kartikey <kartikey406@gmail.com>
Cc: axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
	hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org,
	zhengqi.arch@bytedance.com, shakeel.butt@linux.dev,
	lorenzo.stoakes@oracle.com, yuzhao@google.com,
	heftig@archlinux.org, oleksandr@natalenko.name,
	bgeffon@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	syzbot+90fcab4d88cffed6d0d8@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm: vmscan: always allow writeback during memcg reclaim
Date: Sun, 14 Dec 2025 15:49:44 -0800	[thread overview]
Message-ID: <20251214154944.6a6e91ffb00677a5164074e9@linux-foundation.org> (raw)
In-Reply-To: <20251213083639.364539-1-kartikey406@gmail.com>

On Sat, 13 Dec 2025 14:06:39 +0530 Deepanshu Kartikey <kartikey406@gmail.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.



  reply	other threads:[~2025-12-14 23:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13  8:36 Deepanshu Kartikey
2025-12-14 23:49 ` Andrew Morton [this message]
2025-12-15  4:12 ` Johannes Weiner
2025-12-15  4:51   ` Deepanshu Kartikey
2025-12-15 19:42     ` Yuanchu Xie
2025-12-15 20:22       ` Johannes Weiner
2025-12-19  5:13       ` Kairui Song
2025-12-15  6:59   ` retiring laptop_mode? was " Christoph Hellwig
2025-12-15 16:33     ` Jens Axboe
2025-12-15 20:08     ` Johannes Weiner
2025-12-16  2:23       ` Jens Axboe
2025-12-16  7:41       ` Christoph Hellwig
2025-12-16 18:52         ` Johannes Weiner
2025-12-16 18:54           ` Jens Axboe
2025-12-16 23:23           ` Shakeel Butt
2025-12-17 19:59             ` Johannes Weiner
2025-12-18  7:21               ` Shakeel Butt
2025-12-17 19:34           ` Michal Hocko
2025-12-18  6:00           ` Christoph Hellwig
2025-12-15 17:49   ` Michal Hocko

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=20251214154944.6a6e91ffb00677a5164074e9@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=bgeffon@google.com \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=heftig@archlinux.org \
    --cc=kartikey406@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@kernel.org \
    --cc=oleksandr@natalenko.name \
    --cc=shakeel.butt@linux.dev \
    --cc=syzbot+90fcab4d88cffed6d0d8@syzkaller.appspotmail.com \
    --cc=weixugc@google.com \
    --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