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.6 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 796B1C433DF for ; Mon, 29 Jun 2020 23:35:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 18992206F1 for ; Mon, 29 Jun 2020 23:35:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="j84oukFc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18992206F1 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 5D5FE8D0017; Mon, 29 Jun 2020 19:35:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 586478D000F; Mon, 29 Jun 2020 19:35:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4767F8D0017; Mon, 29 Jun 2020 19:35:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 318348D000F for ; Mon, 29 Jun 2020 19:35:51 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 96BA32DFA for ; Mon, 29 Jun 2020 23:35:50 +0000 (UTC) X-FDA: 76983859260.29.birth92_5107efd26e73 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 6F0F518086E2B for ; Mon, 29 Jun 2020 23:35:50 +0000 (UTC) X-HE-Tag: birth92_5107efd26e73 X-Filterd-Recvd-Size: 6195 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 29 Jun 2020 23:35:49 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 29 Jun 2020 16:34:10 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 29 Jun 2020 16:35:48 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 29 Jun 2020 16:35:48 -0700 Received: from [10.2.91.207] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 29 Jun 2020 23:35:47 +0000 Subject: Re: [PATCH 1/3] mm: Print head flags in dump_page To: Matthew Wilcox CC: , Andrew Morton , Vlastimil Babka References: <20200629151918.15537-1-willy@infradead.org> <20200629151918.15537-2-willy@infradead.org> <20200629225134.GL25523@casper.infradead.org> From: John Hubbard Message-ID: <29baf5ca-1187-e00a-ee5c-5f08f7b69683@nvidia.com> Date: Mon, 29 Jun 2020 16:35:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200629225134.GL25523@casper.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"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1593473650; bh=fIysEGx+4lk41mdEh5Vathhr8fj0lDgLOJyR5B4wY1w=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=j84oukFcUJdMzPBr7+ZWLb1p9K63nOxnn4GKH0PGePfRdHGbUkGXNaHIL64uzRA1n 9A2Ie1ztbtVGcRdKLuiSDsj8FXujC1KFLGHbtQlr0pUW8yzfmPQn+exMv77Zg1gq98 RZP338JSSqWTXOADurlMQhwU376ia/m/k+ymv2SCpdUWuZlsm4S+jzE/9GUPio5aUV nQ88ny4YD5DmpDsaPsMmzd06nlcQYqZ3ahj5Reg1OZXn7e+4S4jfl4rLdm+VNTkcHX +CFq3h4iiNwQkoF14c+4l2snEvYNx6yCVcrvxRe3/80Pe6SCnoh20kFzU8G4R02Moq Y6aIFzBYKgSYA== X-Rspamd-Queue-Id: 6F0F518086E2B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000033, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2020-06-29 15:51, Matthew Wilcox wrote: > On Mon, Jun 29, 2020 at 03:38:13PM -0700, John Hubbard wrote: >> On 2020-06-29 08:19, Matthew Wilcox (Oracle) wrote: >>> Tail page flags contain very little useful information. Print the head >>> page's flags instead (even though PageHead is a little misleading). >> >> You are right about the tail page. And the raw output provides the tail >> page flags, in case someone *really* needs to dig into tail page problems, >> so that's all good. >> >> However, I just gave this a spin, and seeing the "|head" in the list for >> my "tail page: dump_page test" is also slightly misleading for me, too. > > We could also do ... > > @@ -48,6 +48,8 @@ void __dump_page(struct page *page, const char *reason) > struct address_space *mapping; > bool page_poisoned = PagePoisoned(page); > bool compound = PageCompound(page); > + unsigned long flags = page->flags; > + > /* > * Accessing the pageblock without the zone lock. It could change to > * "isolate" again in the meantime, but since we are just dumping the > @@ -165,7 +162,9 @@ void __dump_page(struct page *page, const char *reason) > out_mapping: > BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > > - pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags, > + if (head != page) > + flags = head->flags & ~PG_head; The above should be: flags = head->flags & ~(1UL << PG_head); > + pr_warn("%sflags: %#lx(%pGp)%s\n", type, flags, &flags, > page_cma ? " CMA" : ""); > > hex_only: > ...so with that fix, along with your line break approach in the other thread, a tail page dump of a FOLL_PIN page looks like this: [ 38.027987] page:00000000abaef9ae refcount:513 mapcount:1 mapping:0000000000000000 index:0x11 [ 38.035633] head:00000000675be53c order:9 compound_mapcount:1 compound_pincount:512 [ 38.049155] anon flags: 0x17ffe000000000e(referenced|uptodate|dirty) [ 38.055465] raw: 017ffe0000000000 ffffea0020dd0001 ffffea0020dd0448 dead000000000400 [ 38.062319] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [ 38.069183] head: 017ffe000001000e ffffffff83649ca0 ffffea0020dd8008 ffff88888e0b6641 [ 38.076141] head: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000 [ 38.083102] page dumped because: gup_benchmark: tail page: dump_page test So, good. However, I feel that the "head " prefix approach is slightly preferable, because it's doing less processing (the more code one adds to little-exercised debug paths, the more likely the debugging has bugs) and is instead just printing out what it sees directly. And it seems a little odd to remove the PG_head bit from the output. The "head " prefix approach looks like this: [ 38.027987] page:00000000abaef9ae refcount:513 mapcount:1 mapping:0000000000000000 index:0x11 [ 38.035633] head:00000000675be53c order:9 compound_mapcount:1 compound_pincount:512 [ 38.049155] head anon flags: 0x17ffe000000000e(referenced|uptodate|dirty|head) [ 38.055465] raw: 017ffe0000000000 ffffea0020dd0001 ffffea0020dd0448 dead000000000400 [ 38.062319] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [ 38.069183] head: 017ffe000001000e ffffffff83649ca0 ffffea0020dd8008 ffff88888e0b6641 [ 38.076141] head: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000 [ 38.083102] page dumped because: gup_benchmark: tail page: dump_page test thanks, -- John Hubbard NVIDIA