From: Ingo Molnar <mingo@elte.hu>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
Dave Jones <davej@redhat.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, Len Brown <len.brown@intel.com>,
Mike Travis <travis@sgi.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Thomas Gleixner <tglx@linutronix.de>,
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH V2 0/3] Introduce and use DO_ONCE statement expression macro
Date: Fri, 22 May 2009 09:44:49 +0200 [thread overview]
Message-ID: <20090522074449.GA23810@elte.hu> (raw)
In-Reply-To: <20090522070111.GZ8633@ZenIV.linux.org.uk>
* Al Viro <viro@ZenIV.linux.org.uk> wrote:
> On Thu, May 21, 2009 at 10:39:16PM -0700, Joe Perches wrote:
> > On Fri, 2009-05-22 at 06:26 +0100, Al Viro wrote:
> > > Your DO_ONCE(....) parses as "what the fuck is that?" followed by
> > > grepping for definition, and the cost is much higher.
> >
> > So what do you suggest?
> >
> > #define pr_info_once(fmt, args...) printk_once(KERN_INFO pr_fmt(fmt), ##args)
> > #define pr_warning_once(fmt, args...) printk_once(KERN_WARNING pr_fmt(fmt), ##args)
> > etc
>
> That would be much saner.
Agreed.
The *_once() namespace meme is intuitive and easily understood, and
we use it in a couple of places in the kernel and extend it on an
as-needed basis for reoccuring (and boring and distracting)
once-flag C code spam. We apply it to 'boring to begin with'
constructs: printing a message or a warning, etc. So if a kernel
coder sees a _once() or _ONCE() construct it can be assumed almost
straight away that the code there is largely uninteresting from a
code logic POV.
DO_ONCE() on the other hand is non-intuitive as it is a control
structure that can be applied to _any_ code construct - interesting
and uninteresting alike. For anything truly interesting that is not
a kernel library/facility i dont want it to be hidden and abstracted
away in 98% of the cases, i want to see the raw C form of it.
Otherwise we might as well write the kernel in C++.
Ingo
prev parent reply other threads:[~2009-05-22 7:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-22 4:27 [PATCH V2 0/3] Introduce and use DO_ONCE statement expression macro Joe Perches
2009-05-22 4:27 ` [PATCH V2 1/3] kernel.h: Add " Joe Perches
2009-05-22 4:27 ` [PATCH V2 2/3] arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c: Use DO_ONCE & spelling fix Joe Perches
2009-05-22 4:27 ` [PATCH V2 3/3] kernel.h: Remove unused printk_once Joe Perches
2009-05-22 5:26 ` [PATCH V2 0/3] Introduce and use DO_ONCE statement expression macro Al Viro
2009-05-22 5:39 ` Joe Perches
2009-05-22 7:01 ` Al Viro
2009-05-22 7:44 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090522074449.GA23810@elte.hu \
--to=mingo@elte.hu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cpufreq@vger.kernel.org \
--cc=davej@redhat.com \
--cc=gregkh@suse.de \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--cc=travis@sgi.com \
--cc=venkatesh.pallipadi@intel.com \
--cc=viro@ZenIV.linux.org.uk \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox