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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 DFD6FC43215 for ; Thu, 14 Nov 2019 13:59:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AC584206DA for ; Thu, 14 Nov 2019 13:59:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC584206DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 24FD16B0003; Thu, 14 Nov 2019 08:59:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 201756B0005; Thu, 14 Nov 2019 08:59:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13D526B0006; Thu, 14 Nov 2019 08:59:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id F30BB6B0003 for ; Thu, 14 Nov 2019 08:59:50 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id ADCA3181AEF1F for ; Thu, 14 Nov 2019 13:59:50 +0000 (UTC) X-FDA: 76155041340.24.cloud24_901f4ff9ca510 X-HE-Tag: cloud24_901f4ff9ca510 X-Filterd-Recvd-Size: 2558 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 14 Nov 2019 13:59:50 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E2AC0ABCE; Thu, 14 Nov 2019 13:59:48 +0000 (UTC) Date: Thu, 14 Nov 2019 14:59:48 +0100 From: Michal Hocko To: Ralph Campbell Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/debug: PageAnon() is true for PageKsm() pages Message-ID: <20191114135948.GB1356@dhcp22.suse.cz> References: <20191113000651.20677-1-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113000651.20677-1-rcampbell@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Tue 12-11-19 16:06:51, Ralph Campbell wrote: > PageAnon() and PageKsm() use the low two bits of the page->mapping pointer > to indicate the page type. PageAnon() only checks the LSB while PageKsm() > checks the least significant 2 bits are equal to 3. Therefore, PageAnon() > is true for KSM pages. > __dump_page() incorrectly will never print "ksm" because it checks > PageAnon() first. Fix this by checking PageKsm() first. Thanks for spotting this Fixes: 1c6fb1d89e73 ("mm: print more information about mapping in __dump_page") > Signed-off-by: Ralph Campbell Acked-by: Michal Hocko > --- > mm/debug.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/debug.c b/mm/debug.c > index 772d4cf0691f..0461df1207cb 100644 > --- a/mm/debug.c > +++ b/mm/debug.c > @@ -77,10 +77,10 @@ void __dump_page(struct page *page, const char *reason) > pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n", > page, page_ref_count(page), mapcount, > page->mapping, page_to_pgoff(page)); > - if (PageAnon(page)) > - pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags); > - else if (PageKsm(page)) > + if (PageKsm(page)) > pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags); > + else if (PageAnon(page)) > + pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags); > else if (mapping) { > if (mapping->host && mapping->host->i_dentry.first) { > struct dentry *dentry; > -- > 2.20.1 -- Michal Hocko SUSE Labs