Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp385646pxa; Tue, 11 Aug 2020 05:44:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPY5U3vmf5tOKhZBnKFBAww7GZheILJGXgaDjmuICso+kDe+C1cSSdXC/Dhtqbnq9zpRhN X-Received: by 2002:aa7:c6ce:: with SMTP id b14mr27046129eds.208.1597149853461; Tue, 11 Aug 2020 05:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597149853; cv=none; d=google.com; s=arc-20160816; b=SpagJcbgSnFExY6C7y6f+JWC0rA+R0lQqUQhV6z20JjzAa2qcTAzi6GTuEZcSUhZUS 7u03xM62nP2HXvgsTalunmN8sVEXNpXyyBFfTsOb0vlpReNpiyRBdmBhy45wLfHROpxl udb/JpmehPysCMyoZFXWtFSmQviOrlvjYdP3cwuRyjzYTmuovyxjtKUGJNKrE3ExZIy4 5sesUfBy8hfD/kOj6Np9IKEr9Q6NhOIcKUU7rKDwxwWvZa8QNXITHgwggX+HU7MSrtrH 6OycUrNxffe3DII4Zq9thg+MK5gDcjQ+9VvPjbVBVg6O2Szw8X3yBM7F50XhuwQK6tWB DTNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=XmeLB+CDwEx+BVGhjls7cjEU0kbZMXe9cxQ21+xSvOE=; b=FEc4ncds9+DrKWQCnix5+090muAo+X3eIAa7TzAuBcOYqc62lcn13UeiYIlEJM3A9a xf78SNo7y+LALJURriES3Clo/l/XY/IYZ/4Egvf1BrUWgNr0TMCDQBXEZaKSAF8GGqRl liRPJp5/yKovtZHHYLM+gE6nJkbGRIWYbHIVUv8LfmyWWe0TAxCen7PoM3LDMrrvZ9PY A3mA2EaUOx06sMW2iaXClFqTCZNw4PD7fzQKEd3HbR0bQ4lfkgsUXvwNk/6O9jmRdtq6 2ezmMfUQpi8xDwTvFlEal8OkPynJQ63riSwPnb6n475ejhBlpnAw7WepDqTHNQSMi032 hQUA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si12812515ejx.411.2020.08.11.05.43.50; Tue, 11 Aug 2020 05:44:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728555AbgHKMnF (ORCPT + 99 others); Tue, 11 Aug 2020 08:43:05 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:52603 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbgHKMnE (ORCPT ); Tue, 11 Aug 2020 08:43:04 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0U5TNqJ4_1597149777; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U5TNqJ4_1597149777) by smtp.aliyun-inc.com(127.0.0.1); Tue, 11 Aug 2020 20:42:58 +0800 Subject: Re: [Resend PATCH 2/6] mm/memcg: remove useless check on page->mem_cgroup To: Michal Hocko Cc: akpm@linux-foundation.org, Johannes Weiner , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1597144232-11370-1-git-send-email-alex.shi@linux.alibaba.com> <1597144232-11370-2-git-send-email-alex.shi@linux.alibaba.com> <20200811113008.GK4793@dhcp22.suse.cz> From: Alex Shi Message-ID: Date: Tue, 11 Aug 2020 20:42:28 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200811113008.GK4793@dhcp22.suse.cz> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/8/11 ????7:30, Michal Hocko ะด??: > 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? It's much better, Thanks for correction! > > 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. Right. but the patch is very simple, w/o warning message doesn't cuase trouble. So, removing the 'and keep WARN_ON monitor' make sense too. Do I need a resend for the commit log change? Thanks a lot! Alex > > 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 >