Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp902672ybx; Thu, 31 Oct 2019 02:43:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxY1qk+hoJSbMxmE61icJyIBdGUHamw6nFOD+zjeD06JLC8XzfMuzN11+DSofyaW8P/ethW X-Received: by 2002:a50:fa85:: with SMTP id w5mr4871658edr.113.1572515028107; Thu, 31 Oct 2019 02:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572515028; cv=none; d=google.com; s=arc-20160816; b=bzGWbngGmI6+yBw4WHFkNkrCgyYOY6Gf71pzhQ/otQibkjrM2gUmPlJSK2EI2HGPGt FRihX79MGfuU/y/HbWxB1hig5Ijo0VEgdurzwvgItC+DeoydlFLgylUJdU65YoG616Bw wbOLgHe7UyAqQ3wkV+ZxRIdoGIk5054GHSeJ8qQrC9LQ+DDmBdILMjjp4LOIpy4Kpmqg /8G0BJot+1sUbABy3u3jf7bLKPbQwZz4UFoy5HB/hsOdoD2MQBHuYHscphWYIcjN7o/P bnpIh94vHnKLftUsUC+0Ca0RyL9zUKBn4hKjErdXsBbw9sPe7CvpVshFD4djKGkXouWA FAUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from; bh=s6dU21e/LKXGxvmeHvgDTZqhjPhpGIvnJGywSDxOvUk=; b=ksCMnmCwnFTNCKimdd8NQiIw0FOgnYCjd+QbMEEcM2p23ujim+cAlhI5desDdagqND QdnpsnocpGYz0SrePInQNTR6Ng9FRpLswUjJLMKIVqSMduo2YEjvV17/w8iuNxrmN9oK U1NOs/K307xXSaThEDnho8gyLw+8+71xw7/ItTrm+hAlnl+UlBhvNKbH6EdzNuZPEsGh vRjPerJfKijOdHDCHGYgXIlWFJemdM/RqWqNBzgjqw/SHVkd31/MgDx6b/Un1QQ3ipQB ez8XsH49gDFmKmgl47yGtFqRBybfkh/1hK+lKCwFjctot6+E6kopZDE33Jc1jfRQOzo7 fqdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si3094179ejr.169.2019.10.31.02.43.23; Thu, 31 Oct 2019 02:43:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727338AbfJaJjd convert rfc822-to-8bit (ORCPT + 99 others); Thu, 31 Oct 2019 05:39:33 -0400 Received: from tyo162.gate.nec.co.jp ([114.179.232.162]:38821 "EHLO tyo162.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727153AbfJaJjd (ORCPT ); Thu, 31 Oct 2019 05:39:33 -0400 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: 8BIT MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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 > > Reviewed-by: Shakeel Butt > > Cc: Vladimir Davydov > > Cc: Daniel Jordan > > 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