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 8D1F3C433DF for ; Wed, 1 Jul 2020 02:12:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40EFE2074D for ; Wed, 1 Jul 2020 02:12:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="KJeUGS2g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40EFE2074D 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 E2EFC6B00B5; Tue, 30 Jun 2020 22:12:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDDFF6B00B6; Tue, 30 Jun 2020 22:12:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA6096B00B7; Tue, 30 Jun 2020 22:12:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id B02EF6B00B5 for ; Tue, 30 Jun 2020 22:12:05 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 71731180AD802 for ; Wed, 1 Jul 2020 02:12:05 +0000 (UTC) X-FDA: 76987881810.02.boat03_2507f0b26e7c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 56D2410009BCCCEF for ; Wed, 1 Jul 2020 02:12:05 +0000 (UTC) X-HE-Tag: boat03_2507f0b26e7c X-Filterd-Recvd-Size: 8483 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Jul 2020 02:12:04 +0000 (UTC) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 30 Jun 2020 19:10:24 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 30 Jun 2020 19:12:03 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 30 Jun 2020 19:12:03 -0700 Received: from [10.2.54.200] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 1 Jul 2020 02:12:03 +0000 Subject: Re: [PATCH 1/3] mm: Print head flags in dump_page To: Matthew Wilcox , Vlastimil Babka CC: , Andrew Morton References: <20200629151918.15537-1-willy@infradead.org> <20200629151918.15537-2-willy@infradead.org> <20200629225134.GL25523@casper.infradead.org> <29baf5ca-1187-e00a-ee5c-5f08f7b69683@nvidia.com> <49e5da43-88bd-bac5-4dcc-5f5abb0d9a1b@suse.cz> <20200630115950.GM25523@casper.infradead.org> From: John Hubbard Message-ID: <3c0af8cd-98bd-4690-fffb-69f7e0a2dc58@nvidia.com> Date: Tue, 30 Jun 2020 19:12:02 -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: <20200630115950.GM25523@casper.infradead.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) 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=1593569424; bh=lG6uB73nD5FXt7dfkXN3QOKJiT+0QrGDS84m384WOAg=; 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=KJeUGS2gBn5Y/TrZM3CT0WSI4nqML+Lg38ZNEPst7a05oA4K6qlPY98Vy+vZuolWt 0ofNImcFxagiahvWKZn/YhFRes4WSl4SxsvFr0GUjwi03hBAE0ubKA2HKegHlY/o0z J9GLM2MUXKxFYourarAjwkx0HOTxYzO1rN1im78VX9XWRcXTN9/elSYxYsXbYdfyYN WY8IDqlnDDhzCix1a0+7hzlpJPb4XK4sCx9HC4piMHMlKdOOxPC0vzDC0prl0CE8kJ 0iEvIVX1LQw3NOROQCUqlTAxO20iwjL3DL/4VGy3SP51E4srmU4siAEeXUJFsqHLWb GMo9FVMPaHM6A== X-Rspamd-Queue-Id: 56D2410009BCCCEF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 2020-06-30 04:59, Matthew Wilcox wrote: ... > How about ... > [ 38.049155] flags: 0x17ffe000000000e(anon|referenced|uptodate|dirty|compound) > > That is, change pageflag_names[] to print 'head' as 'compound' and move the > 'anon' or 'ksm' to look like a pageflag. Also CMA. Like this: > > +++ b/include/trace/events/mmflags.h > @@ -96,7 +96,7 @@ > {1UL << PG_private, "private" }, \ > {1UL << PG_private_2, "private_2" }, \ > {1UL << PG_writeback, "writeback" }, \ > - {1UL << PG_head, "head" }, \ > + {1UL << PG_head, "compound" }, \ > {1UL << PG_mappedtodisk, "mappedtodisk" }, \ > {1UL << PG_reclaim, "reclaim" }, \ > {1UL << PG_swapbacked, "swapbacked" }, \ > +++ b/mm/debug.c > @@ -54,7 +54,7 @@ void __dump_page(struct page *page, const char *reason) > * state for debugging, it should be fine to accept a bit of > * inaccuracy here due to racing. > */ > - bool page_cma = is_migrate_cma_page(page); > + char *cma = is_migrate_cma_page(page) ? "|cma" : ""; > int mapcount; > char *type = ""; > > @@ -71,6 +71,10 @@ void __dump_page(struct page *page, const char *reason) > if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) { > /* Corrupt page, cannot call page_mapping */ > mapping = page->mapping; > + if ((unsigned long)mapping & PAGE_MAPPING_ANON) > + mapping = NULL; > + mapping = (struct address_space *) > + ((unsigned long)mapping & ~PAGE_MAPPING_FLAGS); > head = page; > compound = false; > } else { > [...] > if (PageKsm(page)) > - type = "ksm "; > + type = "ksm|"; > else if (PageAnon(page)) > - type = "anon "; > - else if (mapping) { > + type = "anon|"; > + > + BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); > + pr_warn("flags: %#lx(%s%pGp%s)\n", page->flags, type, &page->flags, > + cma); > + > + if (mapping) { > const struct inode *host; > const struct address_space_operations *a_ops; > @@ -163,11 +167,6 @@ 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, > - page_cma ? " CMA" : ""); > - > hex_only: > print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, > sizeof(unsigned long), page, > > Can also delete the 'out_mapping' label this way. OK, so after applying that on top of your original series, and your line-break approach, here's what the output looks like for regular and THP, head and tail pages (all involving FOLL_PIN): THP FOLL_PIN page: head page: [ 42.360473] page:0000000025f35fdb refcount:513 mapcount:1 mapping:0000000000000000 index:0x0 [ 42.368012] head:0000000025f35fdb order:9 compound_mapcount:1 compound_pincount:512 [ 42.374761] flags: 0x17ffe000001000e(anon|referenced|uptodate|dirty|compound) [ 42.380994] raw: 017ffe000001000e ffffffff83649ca0 ffffea0020c80008 ffff888898091901 [ 42.387822] raw: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000 [ 42.394680] page dumped because: gup_benchmark: head page: dump_page test THP FOLL_PIN page: tail page: [ 42.408222] page:00000000803d233b refcount:513 mapcount:1 mapping:0000000000000000 index:0x11 [ 42.415850] head:0000000025f35fdb order:9 compound_mapcount:1 compound_pincount:512 [ 42.422607] flags: 0x17ffe0000000000(anon|) [ 42.425772] raw: 017ffe0000000000 ffffea0020c98001 ffffea0020c98448 dead000000000400 [ 42.432636] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [ 42.439490] head: 017ffe000001000e ffffffff83649ca0 ffffea0020c80008 ffff888898091901 [ 42.446431] head: 0000000000000000 0000000000000000 00000201ffffffff 0000000000000000 [ 42.453355] page dumped because: gup_benchmark: tail page: dump_page test Non-THP FOLL_PIN page: head page: [ 41.513677] page:00000000190e28ba refcount:1025 mapcount:1 mapping:0000000000000000 index:0x0 [ 41.521331] flags: 0x17ffe0000080034(anon|uptodate|lru|active|swapbacked) [ 41.527189] raw: 017ffe0000080034 ffffea002228db08 ffffea0022215108 ffff888898090191 [ 41.534020] raw: 0000000000000000 0000000000000000 0000040100000000 0000000000000000 [ 41.540863] page dumped because: gup_benchmark: head page: dump_page test Non-THP FOLL_PIN page: tail page: [ 41.554472] page:00000000696a8210 refcount:1025 mapcount:1 mapping:0000000000000000 index:0x11 [ 41.562230] flags: 0x17ffe0000080034(anon|uptodate|lru|active|swapbacked) [ 41.568073] raw: 017ffe0000080034 ffffea0022195688 ffffea0021a4e608 ffff888898090191 [ 41.574940] raw: 0000000000000011 0000000000000000 0000040100000000 0000000000000000 [ 41.581768] page dumped because: gup_benchmark: tail page: dump_page test > > (I really like it that we're debating this ... it feels like we've been > in a bit of a push-pull with the debug patches over the years) > Yes, it's good that we're pausing a moment to polish this up. Lots of goodness here and I like the above output. thanks, -- John Hubbard NVIDIA