Messages in this thread |  | | Subject | Re: [PATCH 2/9] ext4: Use pr_fmt and pr_<level> | From | Joe Perches <> | Date | Tue, 20 Mar 2012 02:44:36 -0700 |
| |
On Tue, 2012-03-20 at 09:47 +0100, Jiri Slaby wrote: > Joe writes: "notify a particular set of per subsystem messages that > pr_<level> could easily provide" > > Maybe the concept is not explained well enough that we do not follow?
Basically, when pr_fmt(fmt) is #defined to something other than "#define pr_fmt(fmt) fmt", it could be used as a mechanism to do more than standardize prefixes.
__builtin_strcmp is pretty useful.
You can do things like: (I'm just typing, this may have errors)
#define _first_macro_arg(arg1) arg1 #define first_macro_arg(arg1, ...) _first_macro_arg(arg1)
#define pr_info(fmt, ...) \ do { \ if (!__builtin_strcmp(first_macro_arg(pr_fmt(fmt)), \ KBUILD_MODNAME ": " fmt))) \ advanced_printk(fmt, ##__VA_ARGS__); \ else \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__); \ while (0)
etc...
Anyway, it's been a couple of years since I prototyped something like that and tested file sizes.
The size delta of an allyesconfig was:
-rwxr-xr-x 1 joe joe 926968471 2010-06-29 10:39 vmlinux.allyesconfig.printk_level_with_module -rwxr-xr-x 1 joe joe 927196127 2010-06-23 02:40 vmlinux.allyesconfig.pr_level
It reduced an allyesconfig by .1% It wasn't a huge saving.
I'll play with it again and send an rfc patch in a couple of days.
Maybe I'll prototype a pr_notify mechanism too.
cheers, Joe
|  |