Thread (7 messages) 7 messages, 3 authors, 2020-12-09

Re: [External] Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage

From: Muchun Song <hidden>
Date: 2020-12-09 07:07:25
Also in: linux-mm, lkml

On Wed, Dec 9, 2020 at 11:52 AM Roman Gushchin [off-list ref] wrote:
On Wed, Dec 09, 2020 at 10:31:55AM +0800, Muchun Song wrote:
quoted
On Wed, Dec 9, 2020 at 10:21 AM Roman Gushchin [off-list ref] wrote:
quoted
On Tue, Dec 08, 2020 at 05:51:32PM +0800, Muchun Song wrote:
quoted
The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), so the type of s32
of lruvec_stat_cpu is enough.
Actually the threshold can be as big as MEMCG_CHARGE_BATCH * PAGE_SIZE.
It still fits into s32, but without explicitly saying it it's hard to
understand why not choosing s8, as in vmstat.c.
Yeah, here I need to update the commit log.
quoted
quoted
quoted
The size of struct lruvec_stat is 304 bytes on 64 bits system. As it
is a per-cpu structure. So with this patch, we can save 304 / 2 * ncpu
bytes per-memcg per-node where ncpu is the number of the possible CPU.
If there are c memory cgroup (include dying cgroup) and n NUMA node in
the system. Finally, we can save (152 * ncpu * c * n) bytes.
Honestly, I'm not convinced.
Say, ncpu = 32, n = 2, c = 500. We're saving <5Mb of memory.
If the machine has 128Gb of RAM, it's .000000003%.
Hi Roman,

When the cpu hotplug is enabled, the ncpu can be 256 on
some configurations. Also, the c can be more large when
there are many dying cgroup in the system.

So the savings depends on the environment and
configurations. Right?
Of course, but machines with more CPUs tend to have more RAM as well.
Here I mean possible CPU not online CPU. The number of possible
CPUs may be greater than online CPUs. The per-cpu allocator is based
on the number of possible CPUs. Right?

Thanks.
Thanks!


-- 
Yours,
Muchun
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help