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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 52801C433E0 for ; Tue, 29 Dec 2020 07:22:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DA1920720 for ; Tue, 29 Dec 2020 07:22:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DA1920720 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 736B68D0027; Tue, 29 Dec 2020 02:22:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E6B28D0018; Tue, 29 Dec 2020 02:22:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FC8A8D0027; Tue, 29 Dec 2020 02:22:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4726E8D0018 for ; Tue, 29 Dec 2020 02:22:55 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 06AE2180AD806 for ; Tue, 29 Dec 2020 07:22:55 +0000 (UTC) X-FDA: 77645477910.07.knife62_321048a2749a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id E436B1803FD61 for ; Tue, 29 Dec 2020 07:22:54 +0000 (UTC) X-HE-Tag: knife62_321048a2749a X-Filterd-Recvd-Size: 3321 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 07:22:52 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=rongwei.wang@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0UK7U0GI_1609226560; Received: from 192.168.1.190(mailfrom:rongwei.wang@linux.alibaba.com fp:SMTPD_---0UK7U0GI_1609226560) by smtp.aliyun-inc.com(127.0.0.1); Tue, 29 Dec 2020 15:22:43 +0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [PATCH] mm: rectify a page bad reason From: Rongwei Wang In-Reply-To: Date: Tue, 29 Dec 2020 15:22:39 +0800 Cc: akpm@linux-foundation.org, linux-mm@kvack.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20201229031156.3861-1-rongwei.wang@linux.alibaba.com> To: Muchun Song X-Mailer: Apple Mail (2.3608.120.23.2.4) 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: > On Dec 29, 2020, at 11:21 AM, Muchun Song wrote: >=20 > Rongwei Wang = =E4=BA=8E2020=E5=B9=B412=E6=9C=8829=E6=97=A5=E5=91=A8=E4=BA=8C = =E4=B8=8A=E5=8D=8811:16=E5=86=99=E9=81=93=EF=BC=9A >>=20 >> Hi >>=20 >> When I was doing some memory-related projects, it always reported = error >> "nonzero mapcount", but its judgment condition was that _mapcount was = not equal >> to -1, so I felt the original string was a bit inappropriate, so I = tried to >> update it. >=20 > Hi Rongwei, >=20 > Because the page_mapcount() just returns atomic_read(&page->_mapcount) = + 1, > reporting "nonzero mapcount" is reasonable when _mapcount is -1. Hi, Muchun Thank you for the tip. I read the __dump_page function again. Indeed here need to combine page_mapcount+page_bad_reason to understand, = and reporting "nonzero mapcount" is reasonable. It always feel a little = strange ONLY look at page_bad_reason. Maybe it should be changed (or NOT) to this: if (unlikely(page_mapcount(page) !=3D 0)) bad_reason =3D "nonzero mapcount=E2=80=9D; Anyway, thanks Rongwei Wang >=20 > Thanks. >=20 >>=20 >> Signed-off-by: Rongwei Wang >> --- >> mm/page_alloc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 7a2c89b..57d7f26 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -1114,7 +1114,7 @@ static const char *page_bad_reason(struct page = *page, unsigned long flags) >> const char *bad_reason =3D NULL; >>=20 >> if (unlikely(atomic_read(&page->_mapcount) !=3D -1)) >> - bad_reason =3D "nonzero mapcount"; >> + bad_reason =3D "non-(-1) _mapcount"; >> if (unlikely(page->mapping !=3D NULL)) >> bad_reason =3D "non-NULL mapping"; >> if (unlikely(page_ref_count(page) !=3D 0)) >> -- >> 1.8.3.1