Re: [PATCH 2/3] core: Convert printk_once to use DO_ONCE

From: Joe Perches
Date: Tue Oct 15 2013 - 17:24:48 EST


On Tue, 2013-10-15 at 23:12 +0200, Frederic Weisbecker wrote:
> On Tue, Oct 15, 2013 at 02:00:05PM -0700, Joe Perches wrote:
> > On Tue, 2013-10-15 at 22:50 +0200, Frederic Weisbecker wrote:
> > []
> > > diff --git a/include/linux/printk.h b/include/linux/printk.h
> > []
> > > @@ -252,14 +253,7 @@ extern asmlinkage void dump_stack(void) __cold;
> > >
> > > #ifdef CONFIG_PRINTK
> > > #define printk_once(fmt, ...) \
> > > -({ \
> > > - static bool __print_once; \
> > > - \
> > > - if (!__print_once) { \
> > > - __print_once = true; \
> > > - printk(fmt, ##__VA_ARGS__); \
> > > - } \
> > > -})
> > > + DO_ONCE(printk(fmt, ##__VA_ARGS__));
> >
> > It's hard to believe the overhead is worth it.
>
> Which overhead?

The one you were proposing with xchg

Apparently the 1/3 series you submitted
didn't use it.

Given that it didn't, does the indirection
to DO_ONCE really help?

btw:

https://lkml.org/lkml/2009/5/21/300

Perhaps Alan's comment still applies:

https://lkml.org/lkml/2009/5/21/305


--
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/