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=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 77F66C5519F for ; Wed, 25 Nov 2020 06:25:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A2302206E0 for ; Wed, 25 Nov 2020 06:25:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2302206E0 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 B6D706B006E; Wed, 25 Nov 2020 01:25:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF5926B0070; Wed, 25 Nov 2020 01:25:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E4716B0071; Wed, 25 Nov 2020 01:25:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 849726B006E for ; Wed, 25 Nov 2020 01:25:08 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4E42E180AD806 for ; Wed, 25 Nov 2020 06:25:08 +0000 (UTC) X-FDA: 77521953096.15.shade29_4003cd927374 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 12A8E1814B0C7 for ; Wed, 25 Nov 2020 06:25:08 +0000 (UTC) X-HE-Tag: shade29_4003cd927374 X-Filterd-Recvd-Size: 4552 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 06:25:04 +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=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: 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: =E5=9C=A8 2020/11/25 =E4=B8=8A=E5=8D=881:59, Lorenzo Stoakes =E5=86=99=E9= =81=93: > 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 >=20 > 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: >=20 >=20 > 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; > } >=20 > - VM_WARN_ON_ONCE(!memcg); > if (!memcg) > memcg =3D root_mem_cgroup; >=20 > @@ -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 *pgd= at) > { > + VM_WARN_ON_ONCE_PAGE(!page_memcg(page), page); > return mem_cgroup_lruvec(page_memcg(page), pgdat); > } >=20 Acked. Right. Would you like to remove the bad commit 4b2904f3 ("mm/memcg: add m= issed 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_lruve= c 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; =20 - if (mem_cgroup_disabled()) { + VM_WARN_ON_ONCE(!memcg && !pgdat); + + if (mem_cgroup_disabled() || !memcg) { lruvec =3D &pgdat->__lruvec; goto out; } --=20 2.29.GIT