Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2998230pxa; Sat, 8 Aug 2020 06:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyegbeCUsggV4njgIKEgB3q6Mk7R02NSezx22lthCKwTS9bwfBrkQ8deu3eIM9PkZG3KpAP X-Received: by 2002:a17:906:a8f:: with SMTP id y15mr13713789ejf.140.1596893333943; Sat, 08 Aug 2020 06:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596893333; cv=none; d=google.com; s=arc-20160816; b=se81z85EBGutvMTeVXbMrrQk/HyJNdcLVnHDcj73XiPT/D15PmluJh12FB03Nyj/Mr uHVUnbgrgjCnBwZeO2w/JbwthI4/QL5QCKoaFo9B9VP2tVeZzx6U/B2bMkayzvoZrftJ Pq/dyhXaWTbAAFwu9p6lFDszpp9M4Ov1bnCo3IxmicIDCKjEl1XzyCyY7bUlgkp4Ylmw L+wX++k90oR1ys5zApnkStqUIamrzEAA7n8oCgQZo+FwvMfny6So20KkVGcwk5iT8t0B kZRcuqkppuG8tyJbI/Nw//ypAXttQWKkQp6mhPDchWBd+x/5TLZvHHaVJVdB7U5Bxnww BpkQ== 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:references:cc:to:from :subject; bh=RwukbbIgIkiPKS0vhAVrJEutS6fxLxLED+PwtcV6Crk=; b=prpBt3atYLUv9A71N2mDivY2r1u+3jQ4a/KPJUm3iLpKIBIp12RE1iK+Z3ix3FLeCQ zrb2i0WeXSL/jH66N6poTKHSL0SHagDi3RQRMXiBLeXBzo1j3qjkpFHac2YdrDnVkejR T2i8jUpg7/qVYsxEXUx7C1gEYqZuPJ+r+h/cqyUnIvXDT1ewpxDeMc2+lag8d8ge66Lx kJBDgJjAnLAocedjhbcqmw4uJSGKvMr0Sp6N4GUNLCDOJn5hJ2X15V2j7BZ6yqMilFMA i3WJYa+BgWbmTKIOFXZoxpdxWM0+Usoi1K7iq8lbLYynoWnGOVSFDZ62u0uIA3GntZ2C pZ3w== 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 lt11si6646501ejb.436.2020.08.08.06.27.58; Sat, 08 Aug 2020 06:28:53 -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 S1726250AbgHHNW6 (ORCPT + 99 others); Sat, 8 Aug 2020 09:22:58 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:58819 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgHHNW6 (ORCPT ); Sat, 8 Aug 2020 09:22:58 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0U56q4nE_1596892973; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U56q4nE_1596892973) by smtp.aliyun-inc.com(127.0.0.1); Sat, 08 Aug 2020 21:22:54 +0800 Subject: Re: [PATCH] mm/memcg: remove useless check on page->mem_cgroup From: Alex Shi To: Michal Hocko Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org 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> Message-ID: <4740bac1-72f6-a640-ab6a-a8801e68c27a@linux.alibaba.com> Date: Sat, 8 Aug 2020 21:22:29 +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: <5622ef68-5e70-d1a9-d1be-b45411b6be5c@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 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/5 下午9:02, Alex Shi 写道: > > > 在 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. Any comments for the 2 patches? Thanks Alex > > 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. > > 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 > --- > 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; > >