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=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 4F2FBC433DF for ; Tue, 11 Aug 2020 12:43:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E59AD20756 for ; Tue, 11 Aug 2020 12:43:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E59AD20756 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 558C66B0003; Tue, 11 Aug 2020 08:43:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 509BF6B0005; Tue, 11 Aug 2020 08:43:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D1356B0006; Tue, 11 Aug 2020 08:43:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 24AFA6B0003 for ; Tue, 11 Aug 2020 08:43:12 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CBE631DF2 for ; Tue, 11 Aug 2020 12:43:11 +0000 (UTC) X-FDA: 77138252982.13.lead82_24046b326fe2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 98D4A18140B69 for ; Tue, 11 Aug 2020 12:43:11 +0000 (UTC) X-HE-Tag: lead82_24046b326fe2 X-Filterd-Recvd-Size: 3693 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Aug 2020 12:43:09 +0000 (UTC) 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 X-Rspamd-Queue-Id: 98D4A18140B69 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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: =D4=DA 2020/8/11 =CF=C2=CE=E77:30, Michal Hocko =D0=B4=B5=C0: > 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! >=20 > 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 t= rouble. 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 >=20 > On Tue 11-08-20 19:10:28, Alex Shi wrote: >> If we disabled memcg by cgroup_disable=3Dmemory, 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_e= ntry_t entry) >> VM_BUG_ON_PAGE(PageLRU(page), page); >> VM_BUG_ON_PAGE(page_count(page), page); >> =20 >> + if (mem_cgroup_disabled()) >> + return; >> + >> if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) >> return; >> =20 >> @@ -7163,6 +7166,9 @@ int mem_cgroup_try_charge_swap(struct page *page= , swp_entry_t entry) >> struct mem_cgroup *memcg; >> unsigned short oldid; >> =20 >> + if (mem_cgroup_disabled()) >> + return 0; >> + >> if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) >> return 0; >> =20 >> --=20 >> 1.8.3.1 >=20