From: Roman Gushchin <roman.gushchin@linux.dev>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Yosry Ahmed <yosryahmed@google.com>,
"T . J . Mercier" <tjmercier@google.com>,
kernel-team@meta.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/8] memcg: reduce memory for the lruvec and memcg stats
Date: Wed, 1 May 2024 16:20:45 -0700 [thread overview]
Message-ID: <ZjLOTXEr6XoXf6_g@P9FQF9L96D> (raw)
In-Reply-To: <20240501172617.678560-5-shakeel.butt@linux.dev>
On Wed, May 01, 2024 at 10:26:13AM -0700, Shakeel Butt wrote:
> At the moment, the amount of memory allocated for stats related structs
> in the mem_cgroup corresponds to the size of enum node_stat_item.
> However not all fields in enum node_stat_item have corresponding memcg
> stats. So, let's use indirection mechanism similar to the one used for
> memcg vmstats management.
>
> For a given x86_64 config, the size of stats with and without patch is:
>
> structs size in bytes w/o with
>
> struct lruvec_stats 1128 648
> struct lruvec_stats_percpu 752 432
> struct memcg_vmstats 1832 1352
> struct memcg_vmstats_percpu 1280 960
>
> The memory savings is further compounded by the fact that these structs
> are allocated for each cpu and for each node. To be precise, for each
> memcg the memory saved would be:
>
> Memory saved = ((21 * 3 * NR_NODES) + (21 * 2 * NR_NODES * NR_CPUS) +
> (21 * 3) + (21 * 2 * NR_CPUS)) * sizeof(long)
>
> Where 21 is the number of fields eliminated.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
next prev parent reply other threads:[~2024-05-01 23:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 17:26 [PATCH v4 0/8] memcg: reduce memory consumption by " Shakeel Butt
2024-05-01 17:26 ` [PATCH v4 1/8] memcg: reduce memory size of mem_cgroup_events_index Shakeel Butt
2024-05-01 17:26 ` [PATCH v4 2/8] memcg: dynamically allocate lruvec_stats Shakeel Butt
2024-05-01 23:19 ` Roman Gushchin
2024-05-01 17:26 ` [PATCH v4 3/8] mm: memcg: account memory used for memcg vmstats and lruvec stats Shakeel Butt
2024-05-01 17:26 ` [PATCH v4 4/8] memcg: reduce memory for the lruvec and memcg stats Shakeel Butt
2024-05-01 23:20 ` Roman Gushchin [this message]
2024-05-01 17:26 ` [PATCH v4 5/8] memcg: cleanup __mod_memcg_lruvec_state Shakeel Butt
2024-05-01 17:26 ` [PATCH v4 6/8] mm: cleanup WORKINGSET_NODES in workingset Shakeel Butt
2024-05-01 17:26 ` [PATCH v4 7/8] memcg: warn for unexpected events and stats Shakeel Butt
2024-05-01 23:23 ` Roman Gushchin
2024-05-01 17:26 ` [PATCH v4 8/8] memcg: use proper type for mod_memcg_state Shakeel Butt
2024-05-01 23:23 ` Roman Gushchin
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=ZjLOTXEr6XoXf6_g@P9FQF9L96D \
--to=roman.gushchin@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tjmercier@google.com \
--cc=yosryahmed@google.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