public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>
To: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Vladimir Davydov
	<vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>,
	Chris Down <chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>,
	Yafang Shao <laoar.shao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux Memory Management List
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>
Subject: Re: [External] Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage
Date: Tue, 8 Dec 2020 19:52:35 -0800	[thread overview]
Message-ID: <20201209031115.GA2390587@carbon.lan> (raw)
In-Reply-To: <CAMZfGtUMP6mz3DE7DHS55fyto=LZuQpcitt59WuwhZw8m2LqBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, Dec 09, 2020 at 10:31:55AM +0800, Muchun Song wrote:
> On Wed, Dec 9, 2020 at 10:21 AM Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org> 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.

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.

> > >
> > > 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.

Thanks!

  parent reply	other threads:[~2020-12-09  3:52 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
     [not found] ` <20201208095132.79383-1-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
2020-12-08 18:20   ` Shakeel Butt
2020-12-09  2:21   ` Roman Gushchin
     [not found]     ` <20201209022118.GB2385286-lLJQVQxiE4uLfgCeKHXN1g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-12-09  2:28       ` Roman Gushchin
2020-12-09  2:31       ` [External] " Muchun Song
     [not found]         ` <CAMZfGtUMP6mz3DE7DHS55fyto=LZuQpcitt59WuwhZw8m2LqBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-12-09  3:52           ` Roman Gushchin [this message]
     [not found]             ` <20201209031115.GA2390587-esYZh5BkUNV+urZeOPWqwQ@public.gmane.org>
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=20201209031115.GA2390587@carbon.lan \
    --to=guro-b10kyp2domg@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=laoar.shao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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