linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeelb@google.com>
To: Yafang Shao <laoar.shao@gmail.com>, Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>,  Michal Hocko <mhocko@suse.com>,
	Yafang Shao <shaoyafang@didiglobal.com>
Subject: Re: [PATCH] mm/memcontrol: fix wrong statistics in memory.stat
Date: Tue, 2 Jul 2019 20:51:11 -0700	[thread overview]
Message-ID: <CALvZod4ZUPWSeD1XoDoXc6LCoHkqjkoXTjJbOB_fsbLQnd_fLQ@mail.gmail.com> (raw)
In-Reply-To: <CALvZod68TeAJ_CRgZ0fwh6HhHOwrZ9B4kwMHK+kycPmhR4O46w@mail.gmail.com>

+Johannes for real

On Tue, Jul 2, 2019 at 8:50 PM Shakeel Butt <shakeelb@google.com> wrote:
>
> +Johannes Weiner
>
> On Tue, Jul 2, 2019 at 6:23 PM Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > When we calculate total statistics for memcg1_stats and memcg1_events, we
> > use the the index 'i' in the for loop as the events index.
> > Actually we should use memcg1_stats[i] and memcg1_events[i] as the
> > events index.
> >
> > Fixes: 8de7ecc6483b ("memcg: reduce memcg tree traversals for stats collection")
>
> Actually it fixes 42a300353577 ("mm: memcontrol: fix recursive
> statistics correctness & scalabilty").
>
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > Cc: Shakeel Butt <shakeelb@google.com>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Yafang Shao <shaoyafang@didiglobal.com>
> > ---
> >  mm/memcontrol.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 3ee806b..2ad94d0 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -3528,12 +3528,13 @@ static int memcg_stat_show(struct seq_file *m, void *v)
> >                 if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
> >                         continue;
> >                 seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
> > -                          (u64)memcg_page_state(memcg, i) * PAGE_SIZE);
> > +                          (u64)memcg_page_state(memcg, memcg1_stats[i]) *
> > +                          PAGE_SIZE);
>
> It seems like I made the above very subtle in 8de7ecc6483b and
> Johannes missed this subtlety in 42a300353577 (and I missed it in the
> review).
>
> >         }
> >
> >         for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
> >                 seq_printf(m, "total_%s %llu\n", memcg1_event_names[i],
> > -                          (u64)memcg_events(memcg, i));
> > +                          (u64)memcg_events(memcg, memcg1_events[i]));
> >
> >         for (i = 0; i < NR_LRU_LISTS; i++)
> >                 seq_printf(m, "total_%s %llu\n", mem_cgroup_lru_names[i],
> > --
> > 1.8.3.1
> >
>
> Reviewed-by: Shakeel Butt <shakeelb@google.com>


  reply	other threads:[~2019-07-03  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  1:22 [PATCH] mm/memcontrol: fix wrong statistics in memory.stat Yafang Shao
2019-07-03  3:50 ` Shakeel Butt
2019-07-03  3:51   ` Shakeel Butt [this message]
2019-07-03  4:27   ` Yafang Shao
2019-07-03  5:16     ` Shakeel Butt
2019-07-03  5:56       ` Yafang Shao

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=CALvZod4ZUPWSeD1XoDoXc6LCoHkqjkoXTjJbOB_fsbLQnd_fLQ@mail.gmail.com \
    --to=shakeelb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shaoyafang@didiglobal.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).