Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3226448ybc; Thu, 14 Nov 2019 06:03:10 -0800 (PST) X-Google-Smtp-Source: APXvYqy2NZX5ReSjrkRtBLtMLhcHR+r/O0LyLkCnj3JzBrB1Z76o8mq1DrNNgprKg5BsmpSU2xBD X-Received: by 2002:a17:906:4e53:: with SMTP id g19mr8612727ejw.286.1573740190173; Thu, 14 Nov 2019 06:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573740190; cv=none; d=google.com; s=arc-20160816; b=VuJc0gOIXp1RuENLRHfBPRX3pzDdUxdAsBIJwPV47tBhOv3TBsPaJPaUA51g9AFuiy i6FtgjzSO0LYOn0qZkA9iYfTFmV/jxiLHJUvXQk4NO44QedfRAfSr58FD2XN6bPVFWkP GXHPpe7KI6+GEUABNE6B3aiImGmRSbDF/Dk8FKmL6asSr68QwPJbjyo3I+UWnwSeuXrv rrdqglxnAS0/tvKw/mUlcp86riMj8tErrGxbjDlmuxRNy4AUH1da65VMgjKauaDCs5ZV oPMcHYmXLMRzGtQg8a0TOzh4/xWl8xEqIfc1LJ/yUPvqVFvK6XStuIn4zwF8JfV1ja58 Y4lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=C5mtGNY5oaQgXFVcrRIli1o+s/Q3wughd+rpF42Th2A=; b=L8lNtwyXw8FiuzqzIFj7PG2SI64VayHR5yC9WdRrUgG4wOx2BipGGfp+uKGj2MgilZ eOiwKpKR0mx142o99CX5i6PQP2UizA/tTHP0YeKT+o6iSHGS/i7sSdMLLeMn9rUtT1oz Cp24kaqaEZ/wWSeEshNIctqmf6jywiCd7CkLvvbxCuLSB3c9xW7qtex0N+EGK8nSPuaK uOQxShHk6ykWdu0kju90NXO102qLx+kXiKkwdzCcrcvVaFlCuh33EO8TzjVs7QzwR1Fh +KbXSgPEDW0yti5048mdBnnyaEE2UEoU/9GqT3p6TiEpl3HcZBTQ2zFrGORUfoIwSe2s oONg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si3366634ejy.247.2019.11.14.06.02.41; Thu, 14 Nov 2019 06:03:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbfKNN7u (ORCPT + 99 others); Thu, 14 Nov 2019 08:59:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:39700 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726374AbfKNN7u (ORCPT ); Thu, 14 Nov 2019 08:59:50 -0500 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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