From: Muchun Song <songmuchun@bytedance.com>
To: Roman Gushchin <guro@fb.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shakeel Butt <shakeelb@google.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Chris Down <chris@chrisdown.name>,
Yafang Shao <laoar.shao@gmail.com>,
richard.weiyang@gmail.com, LKML <linux-kernel@vger.kernel.org>,
Cgroups <cgroups@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [External] Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage
Date: Wed, 9 Dec 2020 10:31:55 +0800 [thread overview]
Message-ID: <CAMZfGtUMP6mz3DE7DHS55fyto=LZuQpcitt59WuwhZw8m2LqBg@mail.gmail.com> (raw)
In-Reply-To: <20201209022118.GB2385286@carbon.DHCP.thefacebook.com>
On Wed, Dec 9, 2020 at 10:21 AM Roman Gushchin <guro@fb.com> wrote:
>
> On Tue, Dec 08, 2020 at 05:51:32PM +0800, Muchun Song wrote:
> > The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), so the type of s32
> > of lruvec_stat_cpu is enough. And introduce struct per_cpu_lruvec_stat
> > to optimize memory usage.
> >
> > 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?
>
> Using longs (s64) allows not to think too much about overflows
> and can also be slightly faster on 64-bit machines.
>
> Thanks!
--
Yours,
Muchun
next prev parent reply other threads:[~2020-12-09 2:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 9:51 [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage Muchun Song
2020-12-08 18:20 ` Shakeel Butt
2020-12-09 2:21 ` Roman Gushchin
2020-12-09 2:28 ` Roman Gushchin
2020-12-09 2:31 ` Muchun Song [this message]
2020-12-09 3:52 ` [External] " Roman Gushchin
2020-12-09 7:05 ` Muchun Song
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='CAMZfGtUMP6mz3DE7DHS55fyto=LZuQpcitt59WuwhZw8m2LqBg@mail.gmail.com' \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=chris@chrisdown.name \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=richard.weiyang@gmail.com \
--cc=sfr@canb.auug.org.au \
--cc=shakeelb@google.com \
--cc=vdavydov.dev@gmail.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;
as well as URLs for NNTP newsgroup(s).