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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28AEAC433F5 for ; Wed, 27 Oct 2021 11:28:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4C1160E76 for ; Wed, 27 Oct 2021 11:28:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C4C1160E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3A05A940009; Wed, 27 Oct 2021 07:28:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 350F4940007; Wed, 27 Oct 2021 07:28:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24020940009; Wed, 27 Oct 2021 07:28:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 1226A940007 for ; Wed, 27 Oct 2021 07:28:34 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BBAF818017BFB for ; Wed, 27 Oct 2021 11:28:33 +0000 (UTC) X-FDA: 78741994506.07.7D74CA6 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf01.hostedemail.com (Postfix) with ESMTP id B5D0C5089503 for ; Wed, 27 Oct 2021 11:28:25 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AB17D1FD3C; Wed, 27 Oct 2021 11:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635334111; 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=uD2dxhHpK9q2notNLVD39kCbFRiYvluL6yUhK1PsKnE=; b=OgTxV1Y6JNTiIGb80ajiKuyubcF2+ZH86RabpiRH7X6NNlUsLUuxoutoZjMSoDMOjHmuZ5 s/urI1UQxSHn2b6McCXUdNqQFqUwCFR3rj/6p++koQD3W0VLWoi6WeEVA3hkOyXo9KTP47 S91LXKjTEqLB0Qm3DB7wvOqhDIXVW3Q= Received: from suse.cz (unknown [10.100.224.162]) (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 8A3B8A3B81; Wed, 27 Oct 2021 11:28:31 +0000 (UTC) Date: Wed, 27 Oct 2021 13:28:31 +0200 From: Petr Mladek To: "Matthew Wilcox (Oracle)" Cc: Yafang Shao , Sergey Senozhatsky , linux-mm@kvack.org, Vlastimil Babka , Rasmus Villemoes Subject: Re: [PATCH 5/5] vsprintf: Make %pGp print the hex value Message-ID: References: <20211012182647.1605095-1-willy@infradead.org> <20211012182647.1605095-6-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: r8f4cw7qgsgxs1ncgo8r8coc3jxbi7g1 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=OgTxV1Y6; spf=pass (imf01.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 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B5D0C5089503 X-HE-Tag: 1635334105-297839 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 Fri 2021-10-15 12:55:48, Petr Mladek wrote: > On Tue 2021-10-12 19:26:47, Matthew Wilcox (Oracle) wrote: > > All existing users of %pGp want the hex value as well as the decoded > > flag names. This looks awkward (passing the same parameter to printf > > twice), so move that functionality into the core. If we want, we > > can make that optional with flag arguments to %pGp in the future. > > It makes sense. Just the selftest code is pain, see below ;-) > > > diff --git a/lib/test_printf.c b/lib/test_printf.c > > index 662c3785aa57..a60b1a749e87 100644 > > --- a/lib/test_printf.c > > +++ b/lib/test_printf.c > > @@ -613,6 +613,10 @@ page_flags_test(int section, int node, int zone, int last_cpupid, > > bool append = false; > > int i; > > > > + for (i = 0; i < ARRAY_SIZE(values); i++) > > + page_flags |= (values[i] & pft[i].mask) << pft[i].shift; > > I can't get the idea behind this. IMHO, the value might be zero even > when the related flag is set. > > And the %pGp code seems to always print page flags from > page_flags_fields[] when the field width is not zero. > > Or do I misread the code? Just for record. I really did misread the code. It constructs flags from the given values. It does reverse operation to format_page_flags(). Best Regards, Petr