linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Roman Gushchin <guro@fb.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Michal Hocko <mhocko@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-team@fb.com" <kernel-team@fb.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Daniel Jordan <daniel.m.jordan@oracle.com>
Subject: Re: [PATCH v2] mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly
Date: Thu, 31 Oct 2019 09:38:40 +0000	[thread overview]
Message-ID: <20191031093840.GA9178@hori.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20191030211608.29f8fc92e07fd2ac2ef4d1d3@linux-foundation.org>

On Wed, Oct 30, 2019 at 09:16:08PM -0700, Andrew Morton wrote:
> On Wed, 30 Oct 2019 18:21:51 -0700 Roman Gushchin <guro@fb.com> wrote:
> 
> > page_cgroup_ino() doesn't return a valid memcg pointer for non-compound
> > slab pages, because it depends on PgHead AND PgSlab flags to be set
> > to determine the memory cgroup from the kmem_cache.
> > It's correct for compound pages, but not for generic small pages. Those
> > don't have PgHead set, so it ends up returning zero.
> > 
> > Fix this by replacing the condition to PageSlab() && !PageTail().
> > 
> > Before this patch:
> > [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@0.service/ | grep slab
> > 0x0000000000000080	        38        0  _______S___________________________________	slab
> > 
> > After this patch:
> > [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@0.service/ | grep slab
> > 0x0000000000000080	       147        0  _______S___________________________________	slab
> > 
> > Fixes: 4d96ba353075 ("mm: memcg/slab: stop setting page->mem_cgroup pointer for slab pages")
> > Signed-off-by: Roman Gushchin <guro@fb.com>
> > Reviewed-by: Shakeel Butt <shakeelb@google.com>
> > Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
> > Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
> 
> Affects /proc/kpagecgroup, but page_cgroup_ino() is also used in the
> memory-failure code - I wonder what effect this bug has there?

hwpoison_filter_task() uses output of page_cgroup_ino() in order to
filter error injection events based on memcg.
So if page_cgroup_ino() fails to return memcg pointer, we just fail
to inject memory error.  Considering that hwpoison filter is for testing,
affected users are limited and the impact should be marginal.

> 
> IOW, should we backport this into -stable?

I think yes, because the patch is small enough and clearly fixes a bug.

Thanks,
Naoya Horiguchi

  reply	other threads:[~2019-10-31  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31  1:21 [PATCH v2] mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly Roman Gushchin
2019-10-31  4:16 ` Andrew Morton
2019-10-31  9:38   ` Naoya Horiguchi [this message]
2019-10-31 15:49     ` Roman Gushchin
2019-10-31 18:16 ` David Rientjes

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=20191031093840.GA9178@hori.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --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).