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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 4F9AFC6379D for ; Wed, 25 Nov 2020 06:25:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 063002145D for ; Wed, 25 Nov 2020 06:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgKYGY5 (ORCPT ); Wed, 25 Nov 2020 01:24:57 -0500 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:46548 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbgKYGY5 (ORCPT ); Wed, 25 Nov 2020 01:24:57 -0500 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=e01e04394;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0UGTbpu3_1606285491; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UGTbpu3_1606285491) by smtp.aliyun-inc.com(127.0.0.1); Wed, 25 Nov 2020 14:24:51 +0800 Subject: Re: linux-next boot error: WARNING in prepare_kswapd_sleep To: Lorenzo Stoakes , syzbot , Andrew Morton , Linux Kernel Mailing List , linux-mm , Linux-Next Mailing List , Stephen Rothwell , syzkaller-bugs , Hui Su References: <00000000000054aea005b4d59e71@google.com> From: Alex Shi Message-ID: Date: Wed, 25 Nov 2020 14:24:51 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/11/25 上午1:59, Lorenzo Stoakes 写道: > On Tue, 24 Nov 2020 at 07:54, syzbot > wrote: >> syzbot found the following issue on: >> >> HEAD commit: d9137320 Add linux-next specific files for 20201124 > > This appears to be a product of 4b2904f3 ("mm/memcg: add missed > warning in mem_cgroup_lruvec") adding a VM_WARN_ON_ONCE() to > mem_cgroup_lruvec, which when invoked from a function other than > mem_cgroup_page_lruvec() can in fact be called with the condition > false. > If we move the check back into mem_cgroup_page_lruvec() it resolves > the issue. I enclose a simple version of this below, happy to submit > as a proper patch if this is the right approach: > > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index 87ed56dc75f9..27cc40a490b2 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -618,7 +618,6 @@ static inline struct lruvec > *mem_cgroup_lruvec(struct mem_cgroup *memcg, > goto out; > } > > - VM_WARN_ON_ONCE(!memcg); > if (!memcg) > memcg = root_mem_cgroup; > > @@ -645,6 +644,7 @@ static inline struct lruvec > *mem_cgroup_lruvec(struct mem_cgroup *memcg, > static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page, > struct pglist_data *pgdat) > { > + VM_WARN_ON_ONCE_PAGE(!page_memcg(page), page); > return mem_cgroup_lruvec(page_memcg(page), pgdat); > } > Acked. Right. Would you like to remove the bad commit 4b2904f3 ("mm/memcg: add missed warning in mem_cgroup_lruvec") and replace yours. and further more, could you like try another patch? Thanks Alex >From 073b222bd06a96c39656b0460c705e48c7eedafc Mon Sep 17 00:00:00 2001 From: Alex Shi Date: Wed, 25 Nov 2020 14:06:33 +0800 Subject: [PATCH] mm/memcg: bail out early when !memcg in mem_cgroup_lruvec In some scenarios, we call NULL memcg in mem_cgroup_lruvec(NULL, pgdat) so we could get out early to skip unnecessary check. Also warning if both parameter are NULL. Signed-off-by: Alex Shi --- include/linux/memcontrol.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 3a995bb3157f..5e4da83eb9ce 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -613,7 +613,9 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg, struct mem_cgroup_per_node *mz; struct lruvec *lruvec; - if (mem_cgroup_disabled()) { + VM_WARN_ON_ONCE(!memcg && !pgdat); + + if (mem_cgroup_disabled() || !memcg) { lruvec = &pgdat->__lruvec; goto out; } -- 2.29.GIT