Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp340184pxa; Tue, 11 Aug 2020 04:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp9cWbiuYYRBhEpQy97HN79X387T/VQusOh1GbivdS7vHrQ1+8TsxGx0sXw4ZHMiwz0rB6 X-Received: by 2002:a17:906:dd5:: with SMTP id p21mr27417983eji.416.1597145476810; Tue, 11 Aug 2020 04:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597145476; cv=none; d=google.com; s=arc-20160816; b=l3VUPsb48bBUAM5IB8IIy61sD9o0m9lZVaqEx/Xb3zD0HLnBHu8AMayldaDUfg6dZ6 eou2z4NuLU57FPBlMzPP0bDeYjfcBQXDlK4gtXJIsshdRbXYglHMsOL91MKWuBAx8EjA w11d2YPermfVOz9ecGlHT3In3pnSurU2NxThSFKqQXlCF0lC3rSBqg54QTrgQBz5uvdc iJWKqaJ9i9SaCdrjTYKcLBQT9mfpb/nfGZGKGUejXQTVnb4b4ve+g5M9urJQesmurjxV KSjmJtJXP3ooq6pFa27qVUnplDq4S9+tBX9nMIy4gPCF1JI1G5FIeGNOAxH0MZY1Rdm9 B7Jg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Lg3cSLU4DUd/4HsMNNOo6o1Aaizy1TSzFtcWIVCBNNM=; b=YBv9I8vicuytaBQ257OJJ7N+/OUoyr7N6PSBaZJVSlb+UpsJAGtsBGLSmVM8OIT9A1 wmofnDm7D7Zk6f300IrCoDgVJjpzjm5vne7UYAkzRUmI4W+6kSb5GAD/xBtJ+woHo0EH QD148vr19BF04e/PBQuDlJ56K3FeHO1K8RZQloiLEDPCPSpCwduiWWgiURKu/yn5MBAf CGoywUuDjJTqlhSC0RZDzUylM5rEbB/zDz8UmGr4wvYrhq5WovAcjzywKoS5JwudxNxp ikMZa2s4/lEtht/lZYcQAcVIqkAY6EKfir9o8d0g+/4aGzMV4MR3KsTJHmCqrVXIfOsr quTQ== 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 cz8si12451485edb.455.2020.08.11.04.30.53; Tue, 11 Aug 2020 04:31:16 -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 S1728730AbgHKLaL (ORCPT + 99 others); Tue, 11 Aug 2020 07:30:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:53558 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgHKLaL (ORCPT ); Tue, 11 Aug 2020 07:30:11 -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 E856AAC55; Tue, 11 Aug 2020 11:30:29 +0000 (UTC) Date: Tue, 11 Aug 2020 13:30:08 +0200 From: Michal Hocko To: Alex Shi Cc: akpm@linux-foundation.org, Johannes Weiner , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [Resend PATCH 2/6] mm/memcg: remove useless check on page->mem_cgroup Message-ID: <20200811113008.GK4793@dhcp22.suse.cz> References: <1597144232-11370-1-git-send-email-alex.shi@linux.alibaba.com> <1597144232-11370-2-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1597144232-11370-2-git-send-email-alex.shi@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org subject line looks like a left over. It doesn't match the path. Did you mean memcg: bail out early from swap accounting when memcg is disabled? Btw. if this patch was first in the series then you wouldn't need to mention the warnings that would trigger based on your previous patch. I am fine with both ways but mentioning the warning is usefule. On Tue 11-08-20 19:10:28, Alex Shi wrote: > 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. > > Signed-off-by: Alex Shi > Reviewed-by: Roman Gushchin > Acked-by: Michal Hocko > 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 > --- > mm/memcontrol.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 299382fc55a9..419cf565f40b 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -7098,6 +7098,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; > > @@ -7163,6 +7166,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