From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51921CA9EC3 for ; Thu, 31 Oct 2019 09:39:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20D9D2173E for ; Thu, 31 Oct 2019 09:39:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20D9D2173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ah.jp.nec.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 53BA26B0008; Thu, 31 Oct 2019 05:39:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EBC16B000A; Thu, 31 Oct 2019 05:39:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 406FC6B000C; Thu, 31 Oct 2019 05:39:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 1B3AA6B0008 for ; Thu, 31 Oct 2019 05:39:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id B1AFE181AF5C1 for ; Thu, 31 Oct 2019 09:39:18 +0000 (UTC) X-FDA: 76103581596.23.books36_6e2fe3ac5c424 X-HE-Tag: books36_6e2fe3ac5c424 X-Filterd-Recvd-Size: 4493 Received: from tyo162.gate.nec.co.jp (tyo162.gate.nec.co.jp [114.179.232.162]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Thu, 31 Oct 2019 09:39:16 +0000 (UTC) Received: from mailgate01.nec.co.jp ([114.179.233.122]) by tyo162.gate.nec.co.jp (8.15.1/8.15.1) with ESMTPS id x9V9d5KV030776 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 31 Oct 2019 18:39:05 +0900 Received: from mailsv01.nec.co.jp (mailgate-v.nec.co.jp [10.204.236.94]) by mailgate01.nec.co.jp (8.15.1/8.15.1) with ESMTP id x9V9d5Ds002546; Thu, 31 Oct 2019 18:39:05 +0900 Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv01.nec.co.jp (8.15.1/8.15.1) with ESMTP id x9V9Y0El023154; Thu, 31 Oct 2019 18:39:05 +0900 Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.150] [10.38.151.150]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-9977829; Thu, 31 Oct 2019 18:38:42 +0900 Received: from BPXM23GP.gisp.nec.co.jp ([10.38.151.215]) by BPXC22GP.gisp.nec.co.jp ([10.38.151.150]) with mapi id 14.03.0439.000; Thu, 31 Oct 2019 18:38:41 +0900 From: Naoya Horiguchi To: Andrew Morton CC: Roman Gushchin , "linux-mm@kvack.org" , Michal Hocko , Johannes Weiner , "linux-kernel@vger.kernel.org" , "kernel-team@fb.com" , Vladimir Davydov , Daniel Jordan Subject: Re: [PATCH v2] mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly Thread-Topic: [PATCH v2] mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly Thread-Index: AQHVj6H5mxzEf5Q4l0mAfuJEVZ8f/qdz59AA Date: Thu, 31 Oct 2019 09:38:40 +0000 Message-ID: <20191031093840.GA9178@hori.linux.bs1.fc.nec.co.jp> References: <20191031012151.2722280-1-guro@fb.com> <20191030211608.29f8fc92e07fd2ac2ef4d1d3@linux-foundation.org> In-Reply-To: <20191030211608.29f8fc92e07fd2ac2ef4d1d3@linux-foundation.org> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.34.125.150] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <4592DDEF39464440989A95B815E27759@gisp.nec.co.jp> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-TM-AS-MML: disable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Oct 30, 2019 at 09:16:08PM -0700, Andrew Morton wrote: > On Wed, 30 Oct 2019 18:21:51 -0700 Roman Gushchin wrote: >=20 > > 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. > >=20 > > Fix this by replacing the condition to PageSlab() && !PageTail(). > >=20 > > Before this patch: > > [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.sl= ice/user@0.service/ | grep slab > > 0x0000000000000080 38 0 _______S_______________________= ____________ slab > >=20 > > After this patch: > > [root@localhost ~]# ./page-types -c /sys/fs/cgroup/user.slice/user-0.sl= ice/user@0.service/ | grep slab > > 0x0000000000000080 147 0 _______S_______________________= ____________ slab > >=20 > > Fixes: 4d96ba353075 ("mm: memcg/slab: stop setting page->mem_cgroup poi= nter for slab pages") > > Signed-off-by: Roman Gushchin > > Reviewed-by: Shakeel Butt > > Cc: Vladimir Davydov > > Cc: Daniel Jordan >=20 > 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. >=20 > IOW, should we backport this into -stable? I think yes, because the patch is small enough and clearly fixes a bug. Thanks, Naoya Horiguchi=