Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2000862rwb; Mon, 7 Nov 2022 08:05:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM5/t107pNmqPP9w/Z3bDNmn+Zl+tZWnz061cfm4zZl0k6eaXaRhr5U1YWPg5SH5Pi+Kp9uK X-Received: by 2002:a17:902:c94e:b0:187:190f:6aa7 with SMTP id i14-20020a170902c94e00b00187190f6aa7mr889269pla.131.1667837113986; Mon, 07 Nov 2022 08:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837113; cv=none; d=google.com; s=arc-20160816; b=RKfQ7o+GG3GElwmdW3ybgDhwRAY0R3RNJBOagXrK2LJnIms8h8OyjfpwhRaHGSd291 haK9PGpUKOVj7zubW6igqoDO2MAmZOBzXqjo3Ou8FtNUUgxtFnK9vOPlzPyUU9GOGLzP xIZmnuneiAti6rMdIte94kpJZExMrLvUB0D90WnrHHqq7YtB7pEKeaHqdQ4dKmwrg7fE nNm91HB9aGQkQfyrRnZh5wzQAe2mYXSHJQOXCuuCG1JbDFdxibunMHS7xNUuuNBqo+iS cbEkU4HuYcpcEz3A0hWB5SYIW2VdsF33E+hBgrMM/UPuc0aI3H/atI4Ed9aBN/BidRJs CEVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mh/Y3uwvq82Px8GTLeRTukZSQVpPtpYrFg2LuLtAC6g=; b=h9C2Rx4hdkCjrgKGtk5xjripKpuC4KVXzdfw8NDP9axkJmF6y9zDQfhDX07Yx/cxNn atlFNWvzHhwWOdNNNh5WtA5/5IzxDPDJFmTHxtNr5ZcPGpNF+6YRhX6BPFepZaRDm/eM 5BQRP88unmdF2Sd+M/xy4JR7zmCC15VXSFNQNcjCN0B0nN89JAVOV7rH1nZ1XnKBjwfW ZgRwbWwV5jX7j48GA0bTnsSLLUoOyxvMsiFDYvoSaXYu7ctuefwWyomLC48JlhcGxxhK GI3FwItVoGLo4h8PVZcr3zJZ+0U35dWCqSOYYUvpN291R1tza163bkUyqbZejAPipplz r0PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=EQW19GhD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay1-20020a1709028b8100b00187204e13fcsi9949562plb.516.2022.11.07.08.05.01; Mon, 07 Nov 2022 08:05:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=EQW19GhD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbiKGO10 (ORCPT + 93 others); Mon, 7 Nov 2022 09:27:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232463AbiKGO0s (ORCPT ); Mon, 7 Nov 2022 09:26:48 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9903B27CD1; Mon, 7 Nov 2022 06:20:40 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C9E4E1F8B4; Mon, 7 Nov 2022 14:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667830838; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mh/Y3uwvq82Px8GTLeRTukZSQVpPtpYrFg2LuLtAC6g=; b=EQW19GhDUzPsCd4Jz5cKGqQ9/exV3P6JT8YYRVmXcz/SccfGnGdy07BLLKO9tYe7EhF8uF UbUKVxCTeFzj6i3iOYUpTnh44F8bcM3NFDw5ddx3qkuGX9qwxS25arPDYByTmGR7PhN7Fe PLr68l6X7abgt2o9dKSEjf1glswpnPg= Received: from suse.cz (unknown [10.100.201.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3FB7E2C141; Mon, 7 Nov 2022 14:20:35 +0000 (UTC) Date: Mon, 7 Nov 2022 15:20:34 +0100 From: Petr Mladek To: Andy Shevchenko Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Vlastimil Babka , Naoya Horiguchi , Miaohe Lin , Matthew Wilcox , Minchan Kim , Mel Gorman , Andrea Arcangeli , Dan Williams , Hugh Dickins , Muchun Song , David Hildenbrand , Steven Rostedt , Sergey Senozhatsky , Rasmus Villemoes , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v2 3/3] mm, printk: introduce new format %pGt for page_type Message-ID: References: <20221106140355.294845-1-42.hyeyoo@gmail.com> <20221106140355.294845-4-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2022-11-07 13:18:52, Andy Shevchenko wrote: > On Sun, Nov 06, 2022 at 11:03:55PM +0900, Hyeonggon Yoo wrote: > > dump_page() uses %pGp format to print 'flags' field of struct page. > > As some page flags (e.g. PG_buddy, see page-flags.h for more details) > > are set in page_type field, introduce %pGt format which provides > > human readable output of page_type. And use it in dump_page(). > > > > Note that the sense of bits are different in page_type. if page_type is > > 0xffffffff, no flags are set. if PG_slab (0x00100000) flag is set, > > page_type is 0xffefffff. Clearing a bit means we set the bit. Bits in > > page_type are inverted when printing type names. > > > > Below is examples of dump_page(). One is just after alloc_pages() and > > the other is after __SetPageSlab(). > > > > [ 1.814728] page:ffffea000415e200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105788 > > [ 1.815961] flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff) > > > [ 1.816443] page_type: 0xffffffff() > > Why do we have empty parentheses? I would expect either something there, or no > parentheses at all. This looks fine. format_page_flags() does the same for %pGp. > ... > > > + %pGt 0xffefffff(slab) > > No space before ( ? Also looks fine. %pGp does the same. > ... > > > +static > > +char *format_page_type(char *buf, char *end, unsigned int page_type) > > +{ > > + if (!(page_type & PAGE_TYPE_BASE)) > > + return string(buf, end, "no type for user-mapped page", default_str_spec); > > It's too long, can we make it shorten? I wonder if it would help to write the value. Something like: page_type: 0x0ace5768(no type) That said. I am not familiar with the page types and am not sure about the semantic of this value. MM people should decide what they want to see in this case. > ... > > > pr_warn("%sflags: %pGp%s\n", type, &head->flags, > > page_cma ? " CMA" : ""); > > + pr_warn("page_type: %pGt\n", &head->page_type); > > + > > print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, > > sizeof(unsigned long), page, > > sizeof(struct page), false); > > diff --git a/mm/internal.h b/mm/internal.h > > index cb4c663a714e..956eaa9f12c0 100644 > > --- a/mm/internal.h > > +++ b/mm/internal.h > > @@ -773,6 +773,7 @@ static inline void flush_tlb_batched_pending(struct mm_struct *mm) > > #endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */ > > > > extern const struct trace_print_flags pageflag_names[]; > > +extern const struct trace_print_flags pagetype_names[]; > > extern const struct trace_print_flags vmaflag_names[]; > > extern const struct trace_print_flags gfpflag_names[]; > > I would split this to a separate change, but it's up to PRINTK maintainers. I guess that you are talking about the line: + pr_warn("page_type: %pGt\n", &head->page_type); Yes, it would be better to have implementation of %pGt modifier in one patch and add the user in another one. Best Regards, Petr