[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191031154918.GB31765@tower.DHCP.thefacebook.com>
Date: Thu, 31 Oct 2019 15:49:22 +0000
From: Roman Gushchin <guro@...com>
To: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Michal Hocko <mhocko@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Kernel Team <Kernel-team@...com>,
"Vladimir Davydov" <vdavydov.dev@...il.com>,
Daniel Jordan <daniel.m.jordan@...cle.com>
Subject: Re: [PATCH v2] mm: slab: make page_cgroup_ino() to recognize
non-compound slab pages properly
On Thu, Oct 31, 2019 at 09:38:40AM +0000, Naoya Horiguchi wrote:
> 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@...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@...alhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@...ervice/ | grep slab
> > > 0x0000000000000080 38 0 _______S___________________________________ slab
> > >
> > > After this patch:
> > > [root@...alhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.slice/user@...ervice/ | 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@...com>
> > > Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
> > > Cc: Vladimir Davydov <vdavydov.dev@...il.com>
> > > Cc: Daniel Jordan <daniel.m.jordan@...cle.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.
I agree.
Thanks!
Powered by blists - more mailing lists