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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F224EC4332F for ; Tue, 20 Dec 2022 15:20:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 784D08E0009; Tue, 20 Dec 2022 10:20:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 734A88E0001; Tue, 20 Dec 2022 10:20:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FD9C8E0009; Tue, 20 Dec 2022 10:20:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 53C8F8E0001 for ; Tue, 20 Dec 2022 10:20:34 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 00E3C8049C for ; Tue, 20 Dec 2022 15:20:33 +0000 (UTC) X-FDA: 80263046388.05.74C4AD9 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf09.hostedemail.com (Postfix) with ESMTP id 3C1DA140002 for ; Tue, 20 Dec 2022 15:20:31 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jYfg7x70; spf=pass (imf09.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671549632; a=rsa-sha256; cv=none; b=ma/asPDiQamR9uXfN5U3IBWSqyB3M7HAiKsp0nwWnlnnpBhCcXZskZCsGVHbv8sk52+wwA ZeNHbZg0yOeHFw3kmZUFr54wPoGgWdeznq8XEDBlDxI/DO+X8bbH5F0y6zc8VL2a+KRN7s GIsk2VKxXT6z8036fj3vyWhB+ymVkPI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jYfg7x70; spf=pass (imf09.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671549632; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ReOLkeBvlnpQy6Jl1i4qyjNaQfRlZg2tYB2xamiOUCw=; b=4anz3IotfKg76L6+WgAHeArV7m19NSs+WaJpjm1+9eEEA/CJr8qcbgcyFE3tsbxlXMlGEv TcH1FU/WgUQIEPr8AR7Ulqb4dNTv8S4PVn5oWf26qRqx9v9EK6trEKzOhgY2/Q8MchNy+T /fLBJYePTrRuyZeUH6hF4/T16zjPu3Q= Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 985C75FC3C; Tue, 20 Dec 2022 15:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671549630; 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=ReOLkeBvlnpQy6Jl1i4qyjNaQfRlZg2tYB2xamiOUCw=; b=jYfg7x70vsavP9KVww9ZxBsR8BVHyCw+j1qRM3QSUIksqowPj5Wg3FA+O63hQ+FzF+1214 l8U0K/MkvM6azr7HRDLlhHAbMwKvMTshlfX4xwUs7aV30p+wrrxCCSTnL6PlhYxVeppx8u lK6VMNJstFDjBXFvdoSxI6xvcCKlNF0= Received: from suse.cz (unknown [10.100.208.146]) (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 B75742C141; Tue, 20 Dec 2022 15:20:26 +0000 (UTC) Date: Tue, 20 Dec 2022 16:20:26 +0100 From: Petr Mladek To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , HORIGUCHI =?utf-8?B?TkFPWUEo5aCA5Y+j44CA55u05LmfKQ==?= , Joe Perches , Andy Shevchenko , Matthew WilCox , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v3 3/4] mm, printk: introduce new format %pGt for page_type Message-ID: References: <20221218101901.373450-1-42.hyeyoo@gmail.com> <20221218101901.373450-4-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221218101901.373450-4-42.hyeyoo@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3C1DA140002 X-Stat-Signature: haqe8ykpxrs4x7z8tcmbb1333sxhdt9p X-HE-Tag: 1671549631-53550 X-HE-Meta: U2FsdGVkX1+ykyrUW8aYPITI/vSY4TfulUDu5qOm7T/y9nIVnLyCT4x3f3gMJEqPq/AHrWox05QoZXLVawWVerasJCeJX0NZn/k1EmC/9Stxp0GqPS0SikkHtcrA5KuxelEvKC7UzhZ7ZaF4tE3poNEG/QDYyW8WWJdC14818CyQLgFMVKdJl5CWdE1lYRpN+l5Pn+cJdMULgHULSL3Mtg0TCKywBs1WQDcnsw1cjGWKuRIeXft1mI0mD/eVxsm1hRHVJAfdGwM6+gcE4//VCnIUqwti+7KVKwS9KFD6K2YONcNpeof3HH/CqdcFQ/E2boU6HcfGBxXq81bgxOxsNb76YnmlN9c2OUJ5UTssc8DWGkpcnLbOjd/vhDo1IcCvDo9FbeGhAP8YDqQAHgPilg8e5LR7Wf2RIdLt1hFNiNpf58cO6y+OW75ma6+hws+yBH9GbGDCPvUvVvXWSTzHoZ1yvCviv5I/6KFRhl1qdzflOPtQszozfs0SZzppFhxpGaHN76nv3/2FPnjHuE+smm+DNaLP86dafBWNpFblMrIRZeMqf7ZhiCrjAwbSey+qFsa7Ln8PqAUfGhspXsWul1o7ijyKaBzeKZWuodbmlIcZUh+3TpmDXYJieHs4q9Mtib8Q8CBtl2KBt/d+KnbLnBqHPPMD99imsv8i+s6OfrjqnYymMn5FSc/ftCP3scaUjnf9IUmTHHskjtyeTpzJIEEZ5a8D1D4Ykxevc8K6rAeBqzNQxebH2LqvSjUD6eUzMD/gZc50/GIUlwer9z5+FnmSbSTYh5Zvhbf1BDQdP3cuU7h+CSwkCY0AdrFJH+QDE6E/LJI34tyeaaC379kB2c5Mghkz8Xvq5FC6uOgqPpQ+yO+lUevyAnzsdObknLDv44pJCaWKaavMzDc9bCZQQze0Xvp4xd+s0iXikZHxuNTGedG7PUwX8sVGSRFClleLMbaAWvY1dBdrOlUfryu eJMp+o2H PHL0TV91xmWjZJzY= 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 Sun 2022-12-18 19:19:00, Hyeonggon Yoo wrote: > %pGp format is used 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. > > 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 page type names. > > --- a/Documentation/core-api/printk-formats.rst > +++ b/Documentation/core-api/printk-formats.rst > @@ -575,12 +575,13 @@ The field width is passed by value, the bitmap is passed by reference. > Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease > printing cpumask and nodemask. > > -Flags bitfields such as page flags, gfp_flags > +Flags bitfields such as page flags, page_type, gfp_flags > --------------------------------------------- Please, underline the entire title. Otherwise, "make htmldoc" complains ;-) /prace/kernel/linux/Documentation/core-api/printk-formats.rst:579: WARNING: Title underline too short. Flags bitfields such as page flags, page_type, gfp_flags > > :: > > %pGp 0x17ffffc0002036(referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff) > + %pGt 0xffefffff(slab) > %pGg GFP_USER|GFP_DMA32|GFP_NOWARN > %pGv read|exec|mayread|maywrite|mayexec|denywrite > Please, explain this also in the paragraph below these examples. I would personally refactor it to an itemized list, something like: For printing flags bitfields as a collection of symbolic constants that would construct the value. The type of flags is given by the third character. Currently supported are: - p - [p]age flags, expects value of type (``unsigned long *``) - t - page [t]ype, expects value of type (``unsigned int *``) - v - [v]ma_flags, expects value of type (``unsigned long *``) - g - [g]fp_flags, expects value of type (``gfp_t *``) The flag names and print order depends on the particular type. Rant: Sigh, it looks a bit error prone when similar pointer modifiers expects pointers to different types. I wish there was a way how to check the passed pointer type at compilation time. But it is generic problem with these %p* modifiers. Otherwise the patch looks fine for the vsprinf side. Best Regards, Petr