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=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 05D2EC433E0 for ; Tue, 30 Jun 2020 11:59:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A580820774 for ; Tue, 30 Jun 2020 11:59:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="r/WG0AqN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A580820774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 424916B0055; Tue, 30 Jun 2020 07:59:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FAEA6B005A; Tue, 30 Jun 2020 07:59:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 338DD8D0001; Tue, 30 Jun 2020 07:59:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 1E9DD6B0055 for ; Tue, 30 Jun 2020 07:59:54 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CA975180AD81A for ; Tue, 30 Jun 2020 11:59:53 +0000 (UTC) X-FDA: 76985734266.14.wind91_5b08d3026e77 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 90E8A18229818 for ; Tue, 30 Jun 2020 11:59:53 +0000 (UTC) X-HE-Tag: wind91_5b08d3026e77 X-Filterd-Recvd-Size: 7174 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 11:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qZDy9rthJtg69N64bv0rV4tgScMNBz2DrxmQfXQASuQ=; b=r/WG0AqNN39vQFlLNu5l3N7syc U5ls/aYYvyhl/lBzOmQ0wgFM3NwTuHfp6kFPH8xGtOJftgJ278619AcsKqiOPwqaQ+PW59MwV8zCe TmcCnFBQBm3pT323lGC47HYwjS8X1jcKfC9zd24sadbF7D57n36XEqOOZKWAIBGeRD6nwOqiOE6dZ gCXMWdCpM9IUOiJFZ3CNY8qjAtdAgiMpLSE0tcexdN4TJH0Hgu1sw/0htw9slEefxkWts1zKDu+OU rmBmfnw/pRd28BJvLksHMUTMzimVcMEzuISmCyMQ2wF8xjE5lXftNuJxBoDHCoySU2zB3zDYV99Bu fsjQ6H+Q==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqEvW-0002lb-Hk; Tue, 30 Jun 2020 11:59:50 +0000 Date: Tue, 30 Jun 2020 12:59:50 +0100 From: Matthew Wilcox To: Vlastimil Babka Cc: John Hubbard , linux-mm@kvack.org, Andrew Morton Subject: Re: [PATCH 1/3] mm: Print head flags in dump_page Message-ID: <20200630115950.GM25523@casper.infradead.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49e5da43-88bd-bac5-4dcc-5f5abb0d9a1b@suse.cz> X-Rspamd-Queue-Id: 90E8A18229818 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 30, 2020 at 10:02:50AM +0200, Vlastimil Babka wrote: > I would also prefer this approach.It would be also nice to know the tail index. > As long as page pointer wasn't hashed, it was possible to figure this out, but > now it's not. Maybe print pfn of both page and head? > On 6/30/20 1:35 AM, John Hubbard wrote: > > ...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 index is the last thing printed on this line. If it's something like index:0x12345678, you can reduce it mod 1< > [ 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: > > I would also prefer this approach.It would be also nice to know the tail index. > As long as page pointer wasn't hashed, it was possible to figure this out, but > now it's not. Maybe print pfn of both page and head? > > > [ 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) 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. (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)