[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yd3h2YwGIZs1A+2s@carbon.dhcp.thefacebook.com>
Date: Tue, 11 Jan 2022 12:00:25 -0800
From: Roman Gushchin <guro@...com>
To: Muchun Song <songmuchun@...edance.com>
CC: <willy@...radead.org>, <akpm@...ux-foundation.org>,
<hannes@...xchg.org>, <mhocko@...nel.org>,
<vdavydov.dev@...il.com>, <shakeelb@...gle.com>,
<shy828301@...il.com>, <alexs@...nel.org>,
<richard.weiyang@...il.com>, <david@...morbit.com>,
<trond.myklebust@...merspace.com>, <anna.schumaker@...app.com>,
<jaegeuk@...nel.org>, <chao@...nel.org>,
<kari.argillander@...il.com>, <linux-fsdevel@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-nfs@...r.kernel.org>, <zhengqi.arch@...edance.com>,
<duanxiongchun@...edance.com>, <fam.zheng@...edance.com>,
<smuchun@...il.com>
Subject: Re: [PATCH v5 10/16] mm: list_lru: allocate list_lru_one only when
needed
On Mon, Dec 20, 2021 at 04:56:43PM +0800, Muchun Song wrote:
> In our server, we found a suspected memory leak problem. The kmalloc-32
> consumes more than 6GB of memory. Other kmem_caches consume less than
> 2GB memory.
>
> After our in-depth analysis, the memory consumption of kmalloc-32 slab
> cache is the cause of list_lru_one allocation.
>
> crash> p memcg_nr_cache_ids
> memcg_nr_cache_ids = $2 = 24574
>
> memcg_nr_cache_ids is very large and memory consumption of each list_lru
> can be calculated with the following formula.
>
> num_numa_node * memcg_nr_cache_ids * 32 (kmalloc-32)
>
> There are 4 numa nodes in our system, so each list_lru consumes ~3MB.
>
> crash> list super_blocks | wc -l
> 952
>
> Every mount will register 2 list lrus, one is for inode, another is for
> dentry. There are 952 super_blocks. So the total memory is 952 * 2 * 3
> MB (~5.6GB). But the number of memory cgroup is less than 500. So I
> guess more than 12286 containers have been deployed on this machine (I
> do not know why there are so many containers, it may be a user's bug or
> the user really want to do that). And memcg_nr_cache_ids has not been
> reduced to a suitable value. This can waste a lot of memory.
But on the other side you increase the size of struct list_lru_per_memcg,
so if number of cgroups is close to memcg_nr_cache_ids, we can actually
waste more memory. I'm not saying the change is not worth it, but would be
nice to add some real-world numbers.
Or it's all irrelevant and is done as a preparation to the conversion to xarray?
If so, please, make it clear.
Thanks!
Powered by blists - more mailing lists