Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Qi Zheng <qi.zheng@linux.dev>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
	hughd@google.com, baolin.wang@linux.alibaba.com,
	usama.arif@linux.dev, brauner@kernel.org,
	akpm@linux-foundation.org, Qi Zheng <zhengqi.arch@bytedance.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/3] make unused huge shrinker memcg aware
Date: Tue, 4 Aug 2026 11:51:38 +0800	[thread overview]
Message-ID: <b222ef30-10b6-43a2-8f77-f6108182ba77@linux.dev> (raw)
In-Reply-To: <944bfc30-68e4-4ccb-8b00-f0f86d27cb56@kernel.org>

Hi David,

On 8/3/26 8:21 PM, David Hildenbrand (Arm) wrote:
> On 8/3/26 10:46, Qi Zheng wrote:
>> From: Qi Zheng <zhengqi.arch@bytedance.com>
> 
> I'm missing description and motivation here.

My bad, since v1 was just a single patch, I got lazy and didn't bother
adding a cover letter description later on.

> 
> This is only about shrinking huge pages that span end of shmem files.
> 
> Is this really a problem? And if so, why?

Yes, this is a real-world problem that we encountered in production.

The root cause is that shmem unused shrinker used to be non-memcg-aware.
This could lead to a scenario where reclaim triggered by one memcg A
reclaims the shmem of another memcg B, causing unexpected impact on it.

Even worse, memcg A might have no reclaimable shmem at all, making this
completely useless work and incurring some performance overhead.

such as:

tid 11340 comm scanner locked a page for 182264 us! kstack:
         unlock_page+1
         split_huge_page_to_list+3135
         shmem_unused_huge_shrink+767
         super_cache_scan+329
         do_shrink_slab+291
         shrink_slab+533
         shrink_node+400
         do_try_to_free_pages+206
         try_to_free_mem_cgroup_pages+262
         try_charge_memcg+591
         mem_cgroup_charge+136
         __handle_mm_fault+2431
         handle_mm_fault+194
         do_user_addr_fault+462
         __do_page_fault+176
         do_page_fault+48
         page_fault+62

Later, with Usama's patch [1], the shmem unused shrinker is no longer
triggered during memcg-level reclaim. But this actually doesn't make
sense either, since we can clearly just reclaim from memcg A individuallty.

[1]. 
https://lore.kernel.org/all/20260715103516.2410175-1-usama.arif@linux.dev/

Thanks,
Qi


> 



  reply	other threads:[~2026-08-04  4:20 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
2026-08-03 12:21 ` [PATCH v3 0/3] " David Hildenbrand (Arm)
2026-08-04  3:51   ` Qi Zheng [this message]
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=b222ef30-10b6-43a2-8f77-f6108182ba77@linux.dev \
    --to=qi.zheng@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=brauner@kernel.org \
    --cc=david@kernel.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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