linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	rafael@kernel.org, Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Hugh Dickins <hughd@google.com>, Will Deacon <will@kernel.org>,
	Roman Gushchin <guro@fb.com>, Mike Rapoport <rppt@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	esyr@redhat.com, peterx@redhat.com, krisman@collabora.com,
	Suren Baghdasaryan <surenb@google.com>,
	avagin@openvz.org, Marco Elver <elver@google.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Cgroups <cgroups@vger.kernel.org>
Subject: Re: [External] Re: [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes
Date: Mon, 7 Dec 2020 16:02:54 +0100	[thread overview]
Message-ID: <20201207150254.GL25569@dhcp22.suse.cz> (raw)
In-Reply-To: <CAMZfGtWSEKWqR4f+23xt+jVF-NLSTVQ0L0V3xfZsQzV7aeebhw@mail.gmail.com>

On Mon 07-12-20 22:52:30, Muchun Song wrote:
> On Mon, Dec 7, 2020 at 9:00 PM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Sun 06-12-20 18:14:39, Muchun Song wrote:
> > > Hi,
> > >
> > > This patch series is aimed to convert all THP vmstat counters to pages
> > > and some KiB vmstat counters to bytes.
> > >
> > > The unit of some vmstat counters are pages, some are bytes, some are
> > > HPAGE_PMD_NR, and some are KiB. When we want to expose these vmstat
> > > counters to the userspace, we have to know the unit of the vmstat counters
> > > is which one. It makes the code complex. Because there are too many choices,
> > > the probability of making a mistake will be greater.
> > >
> > > For example, the below is some bug fix:
> > >   - 7de2e9f195b9 ("mm: memcontrol: correct the NR_ANON_THPS counter of hierarchical memcg")
> > >   - not committed(it is the first commit in this series) ("mm: memcontrol: fix NR_ANON_THPS account")
> > >
> > > This patch series can make the code simple (161 insertions(+), 187 deletions(-)).
> > > And make the unit of the vmstat counters are either pages or bytes. Fewer choices
> > > means lower probability of making mistakes :).
> > >
> > > This was inspired by Johannes and Roman. Thanks to them.
> >
> > It would be really great if you could summarize the current and after
> > the patch state so that exceptions are clear and easier to review. The
> 
> Agree. Will do in the next version. Thanks.
> 
> 
> > existing situation is rather convoluted but we have at least units part
> > of the name so it is not too hard to notice that. Reducing exeptions
> > sounds nice but I am not really sure it is such an improvement it is
> > worth a lot of code churn. Especially when it comes to KB vs B. Counting
> 
> There are two vmstat counters (NR_KERNEL_STACK_KB and
> NR_KERNEL_SCS_KB) whose units are KB. If we do this, all
> vmstat counter units are either pages or bytes in the end. When
> we expose those counters to userspace, it can be easy. You can
> reference to:
> 
>     [RESEND PATCH v2 11/12] mm: memcontrol: make the slab calculation consistent
> 
> From this point of view, I think that it is worth doing this. Right?

Well, unless I am missing something, we have two counters in bytes, two
in kB, both clearly distinguishable by the B/KB suffix. Changing KB to B
will certainly reduce the different classes of units, no question about
that, but I am not really sure this is worth all the code churn. Maybe
others will think otherwise.

As I've said the THP accounting change makes more sense to me because it
allows future changes which are already undergoing so there is more
merit in those.
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2020-12-07 15:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 10:14 [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 01/12] mm: memcontrol: fix NR_ANON_THPS account Muchun Song
2020-12-07 12:52   ` Michal Hocko
2020-12-10 16:00   ` Johannes Weiner
2020-12-10 16:02     ` Johannes Weiner
2020-12-10 16:04   ` Johannes Weiner
2020-12-10 16:56     ` [External] " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 02/12] mm: memcontrol: convert NR_ANON_THPS account to pages Muchun Song
2020-12-10 16:10   ` Johannes Weiner
2020-12-10 17:05     ` [External] " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 03/12] mm: memcontrol: convert NR_FILE_THPS " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 04/12] mm: memcontrol: convert NR_SHMEM_THPS " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 05/12] mm: memcontrol: convert NR_SHMEM_PMDMAPPED " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 06/12] mm: memcontrol: convert NR_FILE_PMDMAPPED " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 07/12] mm: memcontrol: convert kernel stack account to bytes Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 08/12] mm: memcontrol: convert NR_KERNEL_SCS_KB " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 09/12] mm: memcontrol: convert vmstat slab counters " Muchun Song
2020-12-07 19:46   ` Roman Gushchin
2020-12-07 20:01     ` Roman Gushchin
2020-12-08  2:44     ` [External] " Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 10/12] mm: memcontrol: scale stat_threshold for byted-sized vmstat Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 11/12] mm: memcontrol: make the slab calculation consistent Muchun Song
2020-12-06 10:14 ` [RESEND PATCH v2 12/12] mm: memcontrol: remove {global_}node_page_state_pages Muchun Song
2020-12-07 13:00 ` [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes Michal Hocko
2020-12-07 14:52   ` [External] " Muchun Song
2020-12-07 15:02     ` Michal Hocko [this message]
2020-12-07 18:51       ` Randy Dunlap
2020-12-08  2:29         ` Muchun Song
2020-12-07 19:51       ` Roman Gushchin
2020-12-07 20:33         ` Hugh Dickins
2020-12-08  2:42           ` Muchun Song
2020-12-08  2:40       ` 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=20201207150254.GL25569@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=cgroups@vger.kernel.org \
    --cc=elver@google.com \
    --cc=esyr@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=krisman@collabora.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --cc=vdavydov.dev@gmail.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).