Re: [PATCH v4 01/17] mm: list_lru: optimize memory consumption of arrays of per cgroup lists
From: Muchun Song <hidden>
Date: 2021-12-15 12:09:49
Also in:
linux-fsdevel, linux-mm, lkml
From: Muchun Song <hidden>
Date: 2021-12-15 12:09:49
Also in:
linux-fsdevel, linux-mm, lkml
On Tue, Dec 14, 2021 at 9:38 PM Johannes Weiner [off-list ref] wrote:
On Tue, Dec 14, 2021 at 12:53:26AM +0800, Muchun Song wrote:quoted
The list_lru uses an array (list_lru_memcg->lru) to store pointers which point to the list_lru_one. And the array is per memcg per node. Therefore, the size of the arrays will be 10K * number_of_node * 8 ( a pointer size on 64 bits system) when we run 10k containers in the system. The memory consumption of the arrays becomes significant. The more numa node, the more memory it consumes.The complexity for the lists themselves is still nrmemcgs * nrnodes right? But the rcu_head goes from that to nrmemcgs.
Right.
quoted
I have done a simple test, which creates 10K memcg and mount point each in a two-node system. The memory consumption of the list_lru will be 24464MB. After converting the array from per memcg per node to per memcg, the memory consumption is going to be 21957MB. It is reduces by 2.5GB. In our AMD servers, there are 8 numa nodes in those system, the memory consumption could be more significant.The code looks good to me, but it would be useful to include a high-level overview of the new scheme, explain that the savings come from the rcu heads, that it simplifies the alloc/dealloc path etc.
Will do in the next version.
With that,quoted
Signed-off-by: Muchun Song <redacted>
Thanks.
Acked-by: Johannes Weiner <hannes@cmpxchg.org>