From: Steven Rostedt <rostedt@goodmis.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Joe Perches <joe@perches.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] seq_file: Use seq_puts when seq_printf has only a format with no args
Date: Sat, 16 Mar 2013 15:21:21 -0400 [thread overview]
Message-ID: <1363461681.25967.114.camel@gandalf.local.home> (raw)
In-Reply-To: <20130316180141.GB21522@ZenIV.linux.org.uk>
On Sat, 2013-03-16 at 18:01 +0000, Al Viro wrote:
> On Sat, Mar 16, 2013 at 10:51:18AM -0700, Joe Perches wrote:
> > > This is certainly a neat trick.
> > >
> > > But I don't really like the fact that it complicates things for every
> > > future code reader, especially when a trivial change in the caller
> > > would accomplish the same thing. Do you have any idea how much
> > > performance we would gain in exchange for the complication?
> >
> > Nope. I believe it's trivial in any case.
> > I just saw Steven's trace hack and thought of seq_printk.
> >
> > Is there a real performance sensitive seq_printf anywhere?
>
> ... and _that_ is the question that should've been asked first.
I totally agree with you. I've been avoiding the "performance
sensitivity" question because of my narcissistic enjoyment of my macro
cleverness ;-)
And also because I have no "F"'n life.
I just figured someone else will point out the lack of clothes the
Emperor has on.
>
> > It's trivial to replace seq_printf("constant") with
> > seq_puts but there are over a thousand of them.
> >
> > It may be better to just leave everything as-is.
>
> Quite. Note that it's not equivalent to gcc treatment of printf/puts -
> there we have cases when it *is* a real hotpath (and I seriously suspect
> that it's in part driven by desire to discourage people from uglifying
> source by manual equivalents of that micro-optimization). Moreover,
> glibc printf at least used to be heavy; kernel-side we are nowhere near
> that bad.
It's also a very hot path in tracing. One reason I only implemented the
macro trick with trace_printk() and not printk() nor seq_printk() is
because I knew those were not hot paths. The reason I created
trace_puts() in the first place, is because I had a bug I was trying to
debug where a trace_printk() would actually make the bug go away. It
added too much of an impact to get the race to trigger. But the
trace_puts() was able to do the trace and still have the bug trigger,
and I was able to debug the problem.
But I enjoyed this conversation while it lasted. Sorry it took up your
time. But it did call to attention that these macros that create
variables should probably have a naming policy to avoid macro traps.
-- Steve
next prev parent reply other threads:[~2013-03-16 19:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 13:50 Joe Perches
2013-03-16 15:43 ` Bjorn Helgaas
2013-03-16 16:11 ` Steven Rostedt
2013-03-16 17:42 ` Joe Perches
2013-03-16 17:51 ` Joe Perches
2013-03-16 18:01 ` Al Viro
2013-03-16 19:21 ` Steven Rostedt [this message]
2013-03-19 3:11 ` [PATCH] checkpatch: Prefer seq_puts to seq_printf Joe Perches
2013-03-16 15:57 ` [RFC PATCH] seq_file: Use seq_puts when seq_printf has only a format with no args Steven Rostedt
2013-03-16 16:15 ` Joe Perches
2013-03-16 17:02 ` Steven Rostedt
2013-03-16 17:54 ` Al Viro
2013-03-18 20:59 ` Andrew Morton
2013-03-19 2:41 ` Joe Perches
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=1363461681.25967.114.camel@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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
all inboxes | Powered by JetHome®