On Tue, Dec 14, 2021 at 12:53:26AM +0800, Muchun Song wrote:
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.
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.
With that,
Signed-off-by: Muchun Song <redacted>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>