Re: [PATCH 1/2] break out page allocation warning code

From: Dave Hansen
Date: Fri Apr 08 2011 - 17:02:15 EST


On Fri, 2011-04-08 at 22:54 +0200, MichaÅ Nazarewicz wrote:
> On Apr 8, 2011 10:23 PM, "Dave Hansen" <dave@xxxxxxxxxxxxxxxxxx> wrote:
> > + if (fmt) {
> > + printk(KERN_WARNING);
> > + va_start(args, fmt);
> > + r = vprintk(fmt, args);
> > + va_end(args);
> > + }
>
> Could we make the "printk(KERN_WARNING);" go away and require caller
> to specify level?

The core problem is this: I want two lines of output: one for the
order/mode gunk, and one for the user-specified message.

If we have the user pass in a string for the printk() level, we're stuck
doing what I have here. If we have them _prepend_ it to the "fmt"
string, then it's harder to figure out below. I guess we could fish in
the string for it.

> > + printk(KERN_WARNING);
> > + printk("%s: page allocation failure: order:%d, mode:0x%x\n",
> > + current->comm, order, gfp_mask);
>
> Even more so here. Why not pr_warning instead of two non-atomic calls
> to printk?

It's a relic of an hour ago when I tried passing in the printk() level
to the function as a string. It can go away now. :)

-- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/