Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp495897pxu; Thu, 7 Jan 2021 10:06:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWJCTKSlEUIymiC+85nn5hYl0PvotuIr034JpMys8Ci64rSkJFapj1CLlpjle9fC9Bl7ve X-Received: by 2002:aa7:cb49:: with SMTP id w9mr2613801edt.357.1610042772349; Thu, 07 Jan 2021 10:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610042772; cv=none; d=google.com; s=arc-20160816; b=mxCkOCQCO/W1h0tah97oxFdUELW98BFr1rqiCeGSukAJ3QdvCHwyrIgpNpkMWzI5Ol EgpqVztffRIxEncLs9ZpuN0scnuWAqI1D82jG4kaV6cdlMbK5mO8vEk8PrEfuhg7+Fne DjGU7LqPXoy4P/qlSr0yc9xpYDdr+8bGQOaAQfqV4RK3IbxyaKMkD+3HKHKUpsNsBgor rmNYbCOoZfk+ciMlSivVhHgGuajJ9ax8DQyi6QrG83LhTCx4JB6j1mcYa9pDBiNwqbBo OmF7Id98souT9Er16A2LZCbWuGNSzvFex4HmFAuJRYIxs4YzOqBH2G9vsQBzthHwTidf J/JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=HF1En/ZEZ2HYH9BzQM+/ovpgdHC3ZwCCGbVQMGFj+To=; b=boK7FypEPY4RzxCQQeiWb9pG8sBgwnkhJiTlMyDtDqZovBO/zL0GFAClpVfPA9rthv NrlTGL/9NaW54jopxA7O4zRfAo5n0ivCPOPzTv2rOJTcTTWl7tk10JOzT5hzDj7Vt7J7 cKT8bdy5jxw94evB1rHG8RLaNARpkSyl3Tzdp5nVOLbZmj+xF9lIhYSALcCXWbHAYdQV ts2cR71IsVaqClAPpCfyVpEims0ap81KovU06hB7U6etGOLIx4heonhAVBcj52dVPr+g JXSsKcd4dfAHMTQ9d81iKdjKKsAisBZA5aW68kHXXQchd/QMjkb1/GiL5C/NI434ojHO AEkQ== 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 dn20si2796518ejc.47.2021.01.07.10.05.49; Thu, 07 Jan 2021 10:06:12 -0800 (PST) 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 S1728997AbhAGSFO (ORCPT + 99 others); Thu, 7 Jan 2021 13:05:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:47258 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727673AbhAGSFO (ORCPT ); Thu, 7 Jan 2021 13:05:14 -0500 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 63ED1AD19; Thu, 7 Jan 2021 18:04:33 +0000 (UTC) Subject: Re: [PATCH] mm/memcontrol: fix warning in mem_cgroup_page_lruvec() To: Hugh Dickins , Andrew Morton Cc: Hui Su , Alex Shi , Lorenzo Stoakes , Michal Hocko , Johannes Weiner , Shakeel Butt , Roman Gushchin , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: From: Vlastimil Babka Message-ID: Date: Thu, 7 Jan 2021 19:04:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/4/21 6:03 AM, Hugh Dickins wrote: > Boot a CONFIG_MEMCG=y kernel with "cgroup_disabled=memory" and you are > met by a series of warnings from the VM_WARN_ON_ONCE_PAGE(!memcg, page) > recently added to the inline mem_cgroup_page_lruvec(). > > An earlier attempt to place that warning, in mem_cgroup_lruvec(), had > been careful to do so after weeding out the mem_cgroup_disabled() case; > but was itself invalid because of the mem_cgroup_lruvec(NULL, pgdat) in > clear_pgdat_congested() and age_active_anon(). > > Warning in mem_cgroup_page_lruvec() was once useful in detecting a KSM > charge bug, so may be worth keeping: but skip if mem_cgroup_disabled(). > > Fixes: 9a1ac2288cf1 ("mm/memcontrol:rewrite mem_cgroup_page_lruvec()") > Signed-off-by: Hugh Dickins Acked-by: Vlastimil Babka > --- > > include/linux/memcontrol.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- 5.11-rc2/include/linux/memcontrol.h 2020-12-27 20:39:36.751923135 -0800 > +++ linux/include/linux/memcontrol.h 2021-01-03 19:38:24.822978559 -0800 > @@ -665,7 +665,7 @@ static inline struct lruvec *mem_cgroup_ > { > struct mem_cgroup *memcg = page_memcg(page); > > - VM_WARN_ON_ONCE_PAGE(!memcg, page); > + VM_WARN_ON_ONCE_PAGE(!memcg && !mem_cgroup_disabled(), page); Nit: I would reverse the order of conditions as mem_cgroup_disabled() is either "return true" or a static key. Not that it matters too much on DEBUG_VM configs... > return mem_cgroup_lruvec(memcg, pgdat); > } > >