Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Qi Zheng <qi.zheng@linux.dev>,
	hughd@google.com, usama.arif@linux.dev, brauner@kernel.org,
	akpm@linux-foundation.org, david@kernel.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Qi Zheng <zhengqi.arch@bytedance.com>
Subject: Re: [PATCH v3 3/3] mm: shmem: make unused huge shrinker memcg aware
Date: Thu, 6 Aug 2026 13:35:26 +0800	[thread overview]
Message-ID: <e638aa5f-a557-4990-82d7-e0fa1e246658@linux.alibaba.com> (raw)
In-Reply-To: <d23cc0d06527e8085bdef645bdce489d9aa15bfc.1785746588.git.zhengqi.arch@bytedance.com>



On 8/3/26 4:46 PM, Qi Zheng wrote:
> From: Qi Zheng <zhengqi.arch@bytedance.com>
> 
> The shmem unused huge shrinker keeps a per-superblock list of inodes whose
> tail huge folio extends beyond i_size. Since that list is not memcg aware,
> reclaim triggered by one memcg can scan inodes from the whole superblock
> and split shmem huge folios charged to unrelated memcgs.
> 
> Convert the shrink list to a memcg-aware list_lru. Queue each inode on the
> list_lru sublist matching the memcg and node of the current tail huge
> folio, so non-root memcg reclaim only walks candidates charged to the
> reclaiming memcg. Global reclaim, root memcg reclaim and shmem quota
> reclaim keep global semantics.
> 
> The list_lru still tracks inodes while the actual split target is the
> current tail huge folio, so validate the folio memcg/node during scan. If
> the folio no longer matches the reclaim context or splitting cannot
> proceed, requeue the inode according to the current tail folio; if the
> inode is no longer shrinkable, drop the scan entry.
> 
> This can be tested with the shrinker debugfs interface by allocating 32
> tmpfs tail THPs in each of two memcgs, then scanning the sb-tmpfs shrinker
> with memcg A's cgroup id:
> 
>                 before A scan    after A scan
>    base         A=64M, B=64M     A=64M, B=64M (per-memcg count is skipped)
>    patched      A=64M, B=64M     A=0,   B=64M
> 
> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
> ---

Apart from the two issues Sashiko pointed out (which you've already 
replied to), nothing else jumped out at me. Thanks.


  reply	other threads:[~2026-08-06  5:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  8:46 [PATCH v3 0/3] make unused huge shrinker memcg aware Qi Zheng
2026-08-03  8:46 ` [PATCH v3 1/3] fs: fix missed removal of super_fs_objects_eligible() Qi Zheng
2026-08-03 21:20   ` Andrew Morton
2026-08-03  8:46 ` [PATCH v3 2/3] mm: shmem: move unused huge shrinklist queuing past the truncation check Qi Zheng
2026-08-05  3:20   ` Baolin Wang
2026-08-03  8:46 ` [PATCH v3 3/3] mm: shmem: make unused huge shrinker memcg aware Qi Zheng
2026-08-06  5:35   ` Baolin Wang [this message]
2026-08-03 12:21 ` [PATCH v3 0/3] " David Hildenbrand (Arm)
2026-08-04  3:51   ` Qi Zheng
2026-08-03 21:24 ` Andrew Morton

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=e638aa5f-a557-4990-82d7-e0fa1e246658@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@kernel.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=qi.zheng@linux.dev \
    --cc=usama.arif@linux.dev \
    --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