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.2 required=3.0 tests=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 DFCE3C33CB2 for ; Tue, 14 Jan 2020 10:23:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B018824679 for ; Tue, 14 Jan 2020 10:23:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B018824679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 418F48E0005; Tue, 14 Jan 2020 05:23:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C9788E0003; Tue, 14 Jan 2020 05:23:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B7E08E0005; Tue, 14 Jan 2020 05:23:57 -0500 (EST) 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 1663B8E0003 for ; Tue, 14 Jan 2020 05:23:57 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id BD2F7181AC9BF for ; Tue, 14 Jan 2020 10:23:56 +0000 (UTC) X-FDA: 76375854072.18.use58_3f81f59f15d01 X-HE-Tag: use58_3f81f59f15d01 X-Filterd-Recvd-Size: 3721 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 10:23:56 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0D991ACE0; Tue, 14 Jan 2020 10:23:54 +0000 (UTC) Subject: Re: [PATCH] mm/page_alloc: Add a reason for reserved pages in has_unmovable_pages() To: Michal Hocko , Anshuman Khandual Cc: David Hildenbrand , Qian Cai , linux-mm@kvack.org, Andrew Morton , Oscar Salvador , Mel Gorman , Mike Rapoport , Dan Williams , Pavel Tatashin , linux-kernel@vger.kernel.org, Ralph Campbell References: <49fa7dea-00ac-155f-e7b7-eeca206556b5@arm.com> <6A58E80B-7A5F-4CAD-ACF1-89BCCBE4D3B1@lca.pw> <20200114091013.GD19428@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: <1f3ff7fc-2f6b-d8e5-85a5-078f0e1a0daf@suse.cz> Date: Tue, 14 Jan 2020 11:23:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200114091013.GD19428@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 1/14/20 10:10 AM, Michal Hocko wrote: > [Cc Ralph] >> The reason is dump_page() does not print page->flags universally >> and only does so for KSM, Anon and File pages while excluding >> reserved pages at boot. Wondering should not we make printing >> page->flags universal ? > > We used to do that and this caught me as a surprise when looking again. > This is a result of 76a1850e4572 ("mm/debug.c: __dump_page() prints an > extra line") which is a cleanup patch and I suspect this result was not > anticipated. > > The following will do the trick but I cannot really say I like the code > duplication. pr_cont in this case sounds like a much cleaner solution to > me. How about this then? diff --git mm/debug.c mm/debug.c index 0461df1207cb..6a52316af839 100644 --- mm/debug.c +++ mm/debug.c @@ -47,6 +47,7 @@ void __dump_page(struct page *page, const char *reason) struct address_space *mapping; bool page_poisoned = PagePoisoned(page); int mapcount; + char *type = ""; /* * If struct page is poisoned don't access Page*() functions as that @@ -78,9 +79,9 @@ void __dump_page(struct page *page, const char *reason) page, page_ref_count(page), mapcount, page->mapping, page_to_pgoff(page)); if (PageKsm(page)) - pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags); + type = "ksm "; else if (PageAnon(page)) - pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags); + type = "anon "; else if (mapping) { if (mapping->host && mapping->host->i_dentry.first) { struct dentry *dentry; @@ -88,10 +89,11 @@ void __dump_page(struct page *page, const char *reason) pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry); } else pr_warn("%ps\n", mapping->a_ops); - pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags); } BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); + pr_warn("%sflags: %#lx(%pGp)\n", type, page->flags, &page->flags); + hex_only: print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, sizeof(unsigned long), page,