Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758011AbbLCATi (ORCPT ); Wed, 2 Dec 2015 19:19:38 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:34023 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757093AbbLCATg convert rfc822-to-8bit (ORCPT ); Wed, 2 Dec 2015 19:19:36 -0500 X-Greylist: delayed 456 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 Dec 2015 19:19:36 EST Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: [PATCH 1/2] mm, printk: introduce new format string for flags From: yalin wang In-Reply-To: <565F5CD9.9080301@suse.cz> Date: Wed, 2 Dec 2015 16:11:58 -0800 Cc: "open list:MEMORY MANAGEMENT" , linux-kernel , Andrew Morton , Joonsoo Kim , Minchan Kim , Sasha Levin , "Kirill A. Shutemov" , Mel Gorman , Michal Hocko , Rasmus Villemoes Content-Transfer-Encoding: 8BIT Message-Id: <1F60C207-1CC2-4B28-89AC-58C72D95A39D@gmail.com> References: <20151125143010.GI27283@dhcp22.suse.cz> <1448899821-9671-1-git-send-email-vbabka@suse.cz> <4EAD2C33-D0E4-4DEB-92E5-9C0457E8635C@gmail.com> <565F5CD9.9080301@suse.cz> To: Vlastimil Babka X-Mailer: Apple Mail (2.3094) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1948 Lines: 52 > On Dec 2, 2015, at 13:04, Vlastimil Babka wrote: > > On 12/02/2015 06:40 PM, yalin wang wrote: > > (please trim your reply next time, no need to quote whole patch here) > >> i am thinking why not make %pg* to be more generic ? >> not restricted to only GFP / vma flags / page flags . >> so could we change format like this ? >> define a flag spec struct to include flag and trace_print_flags and some other option : >> typedef struct { >> unsigned long flag; >> structtrace_print_flags *flags; >> unsigned long option; } flag_sec; >> flag_sec my_flag; >> in printk we only pass like this : >> printk(ā€œ%pg\nā€, &my_flag) ; >> then it can print any flags defined by user . >> more useful for other drivers to use . > > I don't know, it sounds quite complicated given that we had no flags printing > for years and now there's just three kinds of them. The extra struct flag_sec is > IMHO nuissance. No other printk format needs such thing AFAIK? For example, if I > were to print page flags from several places, each would have to define the > struct flag_sec instance, or some header would have to provide it? this can be avoided by provide a macro in header file . we can add a new struct to declare trace_print_flags : for example: #define DECLARE_FLAG_PRINTK_FMT(name, flags_array) flag_spec name = { .flags = flags_array}; #define FLAG_PRINTK_FMT(name, flag) ({ name.flag = flag; &name}) in source code : DECLARE_FLAG_PRINTK_FMT(my_flag, vmaflags_names); printk(ā€œ%pg\nā€, FLAG_PRINTK_FMT(my_flag, vma->flag)); i am not if DECLARE_FLAG_PRINTK_FMT and FLAG_PRINTK_FMT macro can be defined into one macro ? maybe need some trick here . is it possible ? Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/