Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1191117ybc; Tue, 12 Nov 2019 16:10:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyJVBTix5soDd61DPeE69qrS/MzlLlujlBFdsQCDxrej/ae/yKX44lviVkDZzMw/9hfjhUl X-Received: by 2002:aa7:cd69:: with SMTP id ca9mr505149edb.129.1573603844877; Tue, 12 Nov 2019 16:10:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573603844; cv=none; d=google.com; s=arc-20160816; b=YTBrAfvKNwHFqIooa4oLxp5ufGsj9YTPbbOnt+OUvuLpKACFlZ/Dmad27b2pM/zYop Tb/Lbacqlw+PlS2WeaMSYz/RLBkysHQ3FKaXSS7bi9HTmj426/v9dQNEZVCTsqla1dCU THjfHHi0bKnFEv5Zf022jm7+4G4KlffPyWOFxDVgMji/7WqszgaUZHkyqsgY0qrQ3k2o wv4iZUMTxegH5dOgS8XSxiXOAlr2XGOBlrBGve3z+geN4VkI76tJbON4O4M+p46SXen3 YXpFEUDsDstKZZYQEButLzBhN9G9s4DcRzbUVZXiwwbohJhxUFva6YCu7EYAkTrFSNm8 cIeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=/wOVdRHSsqeIyfwUzfQw6fH/HHReWgDJ07fiGrrlSU0=; b=WEzsUQg7dFGYP8w80JWQeQPyGuKmxq4ZJ53TVCCQPv+LDrIgv+wVIde3THESs74qVY p3I3SSxE+LK4/uMRb2J0oD3pwiyre5sGA0PORZWDA40XmMPW+IMWfu9LNu/j6CTJbNGE HUGxA3sJcaCQsOEueT/8QZS7oamO2XWktN1X49+XYNPBrv+QVkLaNI/MNY0kqFzzbHyz YFFZJCHKHt2adVn9pgR+T8pNK7Xb+AlqC97DUPLMU5iZDpiHKpPA3/aJYSvGJv26HJXr Gq7oGa8pRhwpektP999AQxPg5OIKNUd4W2uxuLmXUFi8On5BSDTff6nSwLzZgSrtbryI ShWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=QW5UZ5vx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si101754edp.264.2019.11.12.16.10.20; Tue, 12 Nov 2019 16:10:44 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=QW5UZ5vx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbfKMAGz (ORCPT + 99 others); Tue, 12 Nov 2019 19:06:55 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:10750 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbfKMAGz (ORCPT ); Tue, 12 Nov 2019 19:06:55 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 12 Nov 2019 16:05:59 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 12 Nov 2019 16:06:54 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 12 Nov 2019 16:06:54 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Nov 2019 00:06:54 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Nov 2019 00:06:54 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 13 Nov 2019 00:06:54 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 12 Nov 2019 16:06:54 -0800 From: Ralph Campbell To: Andrew Morton CC: , , Ralph Campbell Subject: [PATCH] mm/debug: PageAnon() is true for PageKsm() pages Date: Tue, 12 Nov 2019 16:06:51 -0800 Message-ID: <20191113000651.20677-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573603559; bh=/wOVdRHSsqeIyfwUzfQw6fH/HHReWgDJ07fiGrrlSU0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=QW5UZ5vxpjFz9atav5kX9c9+UyPG525LYT+G5Wz4q3+G5kxkZrDJOxQ/a3PVIJ0OJ IxK7aOZD8qlXZonGpeXWc6aidXd+DnvD422Rc5dsKYi7mfL17QUyXQ2WhmSOY5FOkJ XbREHVfeG5u80+U6ssxTODbcUFuQtXwOb4TcvfygE/JT3qaUfbpxIsw1bTkveRPAfL yvxWGT7fVQCmV2vz488FCHkwsxqU4gRoWQuTMTN7ORqVUojLc0EijQUlngWVL6LJWJ FfjayWo1gdGlJ3f1K9EgUD0VBlz9Jgch538SVTEuziDeeBHimJ4QOP7ZTRb0T13rc1 zGJBvh4L/c53Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Ralph Campbell --- 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; --=20 2.20.1