Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4178972pxa; Mon, 10 Aug 2020 02:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1vDoF8FhnecuGXj+uFagD3zux8o+1nTOB+RUFztWwFe6NhftvbhHDEaQKBDD92XLKNw/V X-Received: by 2002:a17:906:12c7:: with SMTP id l7mr2089592ejb.306.1597053339944; Mon, 10 Aug 2020 02:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597053339; cv=none; d=google.com; s=arc-20160816; b=YHB8ZUaa6F1WCYGFhdGKzmZcVFGXCYSCWyqRYf1YlxmKmr4spRPMHHMKa/w7T8c+cI 7xKAQdOC7etQmOXLGbfvZgwK+quiIYhdHXDNYASQ+3fAAUoltAI8JDDI52XxBEgyu0fD Aj+4By5YJzQk+J9uZlf34V0iul49ggxk80++LotuLAMThCmsuQ4cgoPIUms6aizTIGj+ aj70jmxNTtwu+V7Df7FjX3wbDMv5wgC0dnJYTfYiExMmoTcZQ/013YCwyOxYk0wZOSiK vUgTolmUKBAkWleTx46HTUDimdw03DlLdqskN1Qs1+Axbz5sI4WQvMpm90eKk8xyXFiq NJkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pAx5EPTZGmIpwuBNSRV5zgePjFL3JKGHhmSdubNBbQg=; b=e2BFmaHGG1uEFelk3UjQA1r/7V2YWG97TaR80HhehGfYNGefulGbXDRPCHng0x2ueH AAwQIhGrkMYr2Zail66knEzIIAZ0+OWqF8D5Q9SDw7b1g0gexbTX8Tj4GeIyfZy/CutQ Z6Caw3rcddyjo5E7uq0qXfug5iBqgJrR8irSlmdTIF4gHmnzYZltVWG2bA3SnRBJbHQq yltzttyMViWfkeUM7UJY/zJbNzgRkvUeOaCubSjTW4GldTQUZtpQvXFPpO5xeMU0pwUd 1ZiZ1vIWT697KXjiKkdt9efgn6/fDigVvcvIWLLHLjl08YuZzKz9EqosBPQzDEahU2Wh F6Fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si10516123eje.263.2020.08.10.02.55.17; Mon, 10 Aug 2020 02:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726688AbgHJJwE (ORCPT + 99 others); Mon, 10 Aug 2020 05:52:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:52282 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbgHJJwE (ORCPT ); Mon, 10 Aug 2020 05:52:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 35B72AD65; Mon, 10 Aug 2020 09:52:22 +0000 (UTC) Date: Mon, 10 Aug 2020 11:52:01 +0200 From: Michal Hocko To: Alex Shi Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memcg: remove useless check on page->mem_cgroup Message-ID: <20200810095201.GC4773@dhcp22.suse.cz> References: <1596166480-22814-1-git-send-email-alex.shi@linux.alibaba.com> <20200731151655.GB491801@cmpxchg.org> <9338716f-ca0e-057f-8d94-03e2b3f70281@linux.alibaba.com> <20200803081815.GD5174@dhcp22.suse.cz> <92dd8e68-8095-72c5-0144-2a084e4d5993@linux.alibaba.com> <5622ef68-5e70-d1a9-d1be-b45411b6be5c@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5622ef68-5e70-d1a9-d1be-b45411b6be5c@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 05-08-20 21:02:30, Alex Shi wrote: > > > 在 2020/8/5 下午8:28, Alex Shi 写道: > > The last patch has a problem on define. this version could fix it. > > > > BTW, I see some !memcg happens when MEMCG compilered but disabled by cgroup_disable > > > > > > [ 94.657666] ---[ end trace f1f34bfc3b32ed2f ]--- > > [ 95.138995] anon flags: 0x5005b48008000d(locked|uptodate|dirty|swapbacked) > > [ 95.146220] raw: 005005b48008000d dead000000000100 dead000000000122 ffff8897c7c76ad1 > > [ 95.154549] raw: 0000000000000022 0000000000000000 0000000200000000 0000000000000000 > > [ 95.162876] page dumped because: VM_WARN_ON_ONCE_PAGE(!memcg) > > > > > > The following patch may helpful. > > >From 8bfb26a2e37e08dc61d20212bcfa5812a367ba94 Mon Sep 17 00:00:00 2001 > From: Alex Shi > Date: Wed, 5 Aug 2020 20:32:12 +0800 > Subject: [PATCH] mm/memcg: don't try charge swap if memcg disabled > > If we disabled memcg by cgroup_disable=memory, the swap charges are > still called. Let's return from the funcs earlier and keep WARN_ON > monitor. Do I get it right that this is on top of your patch to remove the memcg check or a preparatory work? Both are good but it would be better to call that out specifically for clarity (along with the warning if that is a follow up fix). > Signed-off-by: Alex Shi > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Vladimir Davydov > Cc: Andrew Morton > Cc: cgroups@vger.kernel.org > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org Acked-by: Michal Hocko > --- > mm/memcontrol.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index cb07a48d53aa..65f2b42d25af 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -7163,6 +7163,9 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry) > VM_BUG_ON_PAGE(PageLRU(page), page); > VM_BUG_ON_PAGE(page_count(page), page); > > + if (mem_cgroup_disabled()) > + return; > + > if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) > return; > > @@ -7228,6 +7231,9 @@ int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry) > struct mem_cgroup *memcg; > unsigned short oldid; > > + if (mem_cgroup_disabled()) > + return 0; > + > if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) > return 0; > > -- > 1.8.3.1 -- Michal Hocko SUSE Labs