All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Roman Gushchin <guro@fb.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Michal Hocko <mhocko@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] mm: workingset: fix vmstat counters for shadow nodes
Date: Mon, 5 Aug 2019 15:43:41 -0400	[thread overview]
Message-ID: <20190805194341.GA6260@cmpxchg.org> (raw)
In-Reply-To: <20190801233532.138743-1-guro@fb.com>

On Thu, Aug 01, 2019 at 04:35:32PM -0700, Roman Gushchin wrote:
> Memcg counters for shadow nodes are broken because the memcg pointer is
> obtained in a wrong way. The following approach is used:
> 	virt_to_page(xa_node)->mem_cgroup
> 
> Since commit 4d96ba353075 ("mm: memcg/slab: stop setting page->mem_cgroup
> pointer for slab pages") page->mem_cgroup pointer isn't set for slab pages,
> so memcg_from_slab_page() should be used instead.
> 
> Also I doubt that it ever worked correctly: virt_to_head_page() should be
> used instead of virt_to_page(). Otherwise objects residing on tail pages
> are not accounted, because only the head page contains a valid mem_cgroup
> pointer. That was a case since the introduction of these counters by the
> commit 68d48e6a2df5 ("mm: workingset: add vmstat counter for shadow nodes").

You're right. slub uses order-2 compound pages for radix_tree_node, so
we've been underreporting shadow nodes placed in the three tail pages.

Nice catch.

> Fixes: 4d96ba353075 ("mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages")
> Signed-off-by: Roman Gushchin <guro@fb.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>


      reply	other threads:[~2019-08-05 19:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 23:35 [PATCH] mm: workingset: fix vmstat counters for shadow nodes Roman Gushchin
2019-08-05 19:43 ` Johannes Weiner [this message]

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=20190805194341.GA6260@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.