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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 B8E46C35242 for ; Sun, 9 Feb 2020 01:18:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5CD2E22464 for ; Sun, 9 Feb 2020 01:18:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="OwaOwVKe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CD2E22464 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CE2A46B0007; Sat, 8 Feb 2020 20:18:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C93166B0008; Sat, 8 Feb 2020 20:18:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5B9E6B000A; Sat, 8 Feb 2020 20:18:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 9C24F6B0007 for ; Sat, 8 Feb 2020 20:18:04 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 42797180AD801 for ; Sun, 9 Feb 2020 01:18:04 +0000 (UTC) X-FDA: 76468827288.30.event49_c2d9e6b0b93d X-HE-Tag: event49_c2d9e6b0b93d X-Filterd-Recvd-Size: 6476 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Sun, 9 Feb 2020 01:18:03 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sat, 08 Feb 2020 17:17:48 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sat, 08 Feb 2020 17:18:02 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sat, 08 Feb 2020 17:18:02 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 9 Feb 2020 01:18:01 +0000 Subject: Re: [PATCH] mm: Improve dump_page() for compound pages To: Matthew Wilcox , CC: "Kirill A . Shutemov" References: <20200208044415.30012-1-willy@infradead.org> From: John Hubbard X-Nvconfidentiality: public Message-ID: <96e1f693-0e7b-2817-f13d-1946ff7654a1@nvidia.com> Date: Sat, 8 Feb 2020 17:18:01 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200208044415.30012-1-willy@infradead.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581211068; bh=7T7IEPSbWHFQyNo4vSCI5EwesasgEY0XIp0vlwe9l+E=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=OwaOwVKe0k2/6P+S+9rmbSXlVkF8eif3oMvZf1F+3WU7UF91DAUCIIweg2QeDreAU bipiZ8JvNANFh23pRmFrCvAM6pC7BoguP7xh2blzmM1hr4if1rcbjyh+hjiOcHPg+p yMYM3NWUj59chQgaZNqlmxg2cBvNbhhWsPXQkQ5a7Unro4jBy895Ou9ux/hzqTzUeL m0m0BlkKm62EToxBBieXbhdMMG+2esc0KXmZZ1SA2R1A6N0k3JlEM2CGTsDXcKUwSC z0fdQB7bxL9ycPtv/azIdGWCqWdaAx0ZKmhSr/uqgiLDXX7+ZoXO8SCNkBwvEYFpl6 eXaTQdZ1CgcHQ== 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 2/7/20 8:44 PM, Matthew Wilcox wrote: ... > - if (PageCompound(page)) > - pr_warn("page:%px refcount:%d mapcount:%d mapping:%px " > - "index:%#lx compound_mapcount: %d\n", > - page, page_ref_count(page), mapcount, > - page->mapping, page_to_pgoff(page), > - compound_mapcount(page)); > + if (compound) > + pr_warn("page:%px refcount:%d mapcount:%d mapping:%p " > + "index:%#lx head:%px order:%u compound_mapcount:%d\n", > + page, page_ref_count(head), mapcount, > + mapping, page_to_pgoff(page), head, > + compound_order(head), compound_mapcount(page)); OK, so the patch now produces the following output for a normal page and a huge page: page:ffffea0011f68540 refcount:1025 mapcount:1 mapping:00000000b9ef1410 index:0x0 anon flags: 0x17ffe0000080036(referenced|uptodate|lru|active|swapbacked) raw: 017ffe0000080036 ffffea0011f684c8 ffffea0010eeab88 ffff888495396581 raw: 0000000000000000 0000000000000000 0000040100000000 0000000000000000 page dumped because: test: dump_page() page:ffffea0010ed2740 refcount:513 mapcount:1 mapping:00000000b9ef1410 index:0xb2 head:ffffea0010ed0000 order:9 compound_mapcount:1 anon flags: 0x17ffe0000000000() raw: 017ffe0000000000 ffffea0010ed0001 ffffea0010ed2748 dead000000000400 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 head: 017ffe0000090036 ffffea0011ff8ec8 ffffea0010ed8008 ffff888495396581 head: 0000000000000015 0000000000000000 00000201ffffffff 0000000000000000 page dumped because: test: dump_page() ...which is looking very good! Minor point: How do you and everyone feel about the line length? I do see it getting pretty long, and I'm about to add the following to it, as a separate patch on top of this: "compound_pincount:N" ...which just makes it even worse. And on some serial terminals this can get cut off, so I'm wondering if maybe doing another pr_warn(), and a duplicated page pointer output, to break up the line would help, like this output: page:ffffea0010ed2740 refcount:513 mapcount:1 mapping:00000000b9ef1410 index:0xb2 head:ffffea0010ed0000 page:ffffea0010ed2740 order:9 compound_mapcount:1 anon flags: 0x17ffe0000000000() raw: 017ffe0000000000 ffffea0010ed0001 ffffea0010ed2748 dead000000000400 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 head: 017ffe0000090036 ffffea0011ff8ec8 ffffea0010ed8008 ffff888495396581 head: 0000000000000015 0000000000000000 00000201ffffffff 0000000000000000 page dumped because: test: dump_page() ...which then becomes this, in a future patch: page:ffffea0010ed2740 refcount:513 mapcount:1 mapping:00000000b9ef1410 index:0xb2 head:ffffea0010ed0000 page:ffffea0010ed2740 order:9 compound_mapcount:1 compound_pincount:1 anon flags: 0x17ffe0000000000() raw: 017ffe0000000000 ffffea0010ed0001 ffffea0010ed2748 dead000000000400 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 head: 017ffe0000090036 ffffea0011ff8ec8 ffffea0010ed8008 ffff888495396581 head: 0000000000000015 0000000000000000 00000201ffffffff 0000000000000000 page dumped because: test: dump_page() ...or is it best in your experience to leave that line as an "atomic" print statement? thanks, -- John Hubbard NVIDIA > else > - pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n", > + pr_warn("page:%px refcount:%d mapcount:%d mapping:%p index:%#lx\n", > page, page_ref_count(page), mapcount, > - page->mapping, page_to_pgoff(page)); > + mapping, page_to_pgoff(page)); > if (PageKsm(page)) > type = "ksm "; > else if (PageAnon(page)) > @@ -106,6 +115,10 @@ void __dump_page(struct page *page, const char *reason) > print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, > sizeof(unsigned long), page, > sizeof(struct page), false); > + if (head != page) > + print_hex_dump(KERN_WARNING, "head: ", DUMP_PREFIX_NONE, 32, > + sizeof(unsigned long), head, > + sizeof(struct page), false); > > if (reason) > pr_warn("page dumped because: %s\n", reason); >