linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huaweicloud.com>
To: Johannes Weiner <hannes@cmpxchg.org>, Yu Zhao <yuzhao@google.com>
Cc: akpm@linux-foundation.org, david@kernel.org,
	lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
	vbabka@suse.cz, rppt@kernel.org, surenb@google.com,
	mhocko@suse.com, axelrasmussen@google.com, yuanchu@google.com,
	weixugc@google.com, zhengqi.arch@bytedance.com,
	shakeel.butt@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, lujialin4@huawei.com,
	chenridong@huawei.com
Subject: Re: [RFC -next] memcg: Optimize creation performance when LRU_GEN is enabled
Date: Thu, 4 Dec 2025 21:01:49 +0800	[thread overview]
Message-ID: <b2b20f83-6785-4410-82a7-506c594e487e@huaweicloud.com> (raw)
In-Reply-To: <ef8f934d-6792-4b6d-8f47-81f78edc1e93@huaweicloud.com>



On 2025/12/4 20:59, Chen Ridong wrote:
> 
> 
> On 2025/11/27 17:04, Chen Ridong wrote:
>>
>>
>> On 2025/11/27 1:15, Johannes Weiner wrote:
>>> On Wed, Nov 19, 2025 at 08:37:22AM +0000, Chen Ridong wrote:
>>>> From: Chen Ridong <chenridong@huawei.com>
>>>>
>>>> With LRU_GEN=y and LRU_GEN_ENABLED=n, a performance regression occurs
>>>> when creating a large number of memory cgroups (memcgs):
>>>>
>>>> 	# time mkdir testcg_{1..10000}
>>>>
>>>> 	real	0m7.167s
>>>> 	user	0m0.037s
>>>> 	sys	0m6.773s
>>>>
>>>> 	# time mkdir testcg_{1..20000}
>>>>
>>>> 	real	0m27.158s
>>>> 	user	0m0.079s
>>>> 	sys	0m26.270s
>>>>
>>>> In contrast, with LRU_GEN=n, creation of the same number of memcgs
>>>> performs better:
>>>>
>>>> 	# time mkdir testcg_{1..10000}
>>>>
>>>> 	real	0m3.386s
>>>> 	user	0m0.044s
>>>> 	sys	0m3.009s
>>>>
>>>> 	# time mkdir testcg_{1..20000}
>>>>
>>>> 	real	0m6.876s
>>>> 	user	0m0.075s
>>>> 	sys	0m6.121s
>>>>
>>>> The root cause is that lru_gen node onlining uses hlist_nulls_add_tail_rcu,
>>>> which traverses the entire list to find the tail. This traversal scales
>>>> with the number of memcgs, even when LRU_GEN is runtime-disabled.
>>>
>>> Can you please look into removing the memcg LRU instead?
>>>
>>
>> Thanks Johannes, this is indeed a promising approach.
>>
>> The memcg LRU was originally designed exclusively for global reclaim scenarios. Before we move
>> forward with its removal, I'd like to hear Yu's thoughts on this.
>>
>> Hello Yu,
>>
>> Do you have any opinions on removing the memcg LRU?
>>
> 
> Hello Johannes and Yu,
> 
> I've sent patches to remove the memcg LRU and replace it with mem_cgroup_iter.
> I would appreciate it if you could take a look when you have time.
> 

Just adding the link to the patch series:

https://lore.kernel.org/cgroups/20251204123124.1822965-1-chenridong@huaweicloud.com/T/#t

-- 
Best regards,
Ridong



      reply	other threads:[~2025-12-04 13:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  8:37 Chen Ridong
2025-11-24  3:52 ` Chen Ridong
2025-11-26  2:29   ` Chen Ridong
2025-11-26 17:15 ` Johannes Weiner
2025-11-27  9:04   ` Chen Ridong
2025-12-04 12:59     ` Chen Ridong
2025-12-04 13:01       ` Chen Ridong [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=b2b20f83-6785-4410-82a7-506c594e487e@huaweicloud.com \
    --to=chenridong@huaweicloud.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=chenridong@huawei.com \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lujialin4@huawei.com \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --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