From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>,
James Morris <jmorris@namei.org>,
LKML <linux-kernel@vger.kernel.org>,
Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH] cred: Remove unnecessary kdebug atomic reads
Date: Tue, 25 Aug 2015 13:51:06 -0700 [thread overview]
Message-ID: <1440535866.2670.164.camel@perches.com> (raw)
In-Reply-To: <20150825133925.654019415dbe3d2083e5f8c7@linux-foundation.org>
On Tue, 2015-08-25 at 13:39 -0700, Andrew Morton wrote:
> On Tue, 25 Aug 2015 09:53:51 -0700 Joe Perches <joe@perches.com> wrote:
> > commit e0e817392b9a ("CRED: Add some configurable debugging [try #6]")
> > added the kdebug mechanism to this file back in 2009.
> >
> > The kdebug macro calls no_printk which always evaluates arguments.
> >
> > Most of the kdebug uses have an unnecessary call of
> > atomic_read(&cred->usage)
> >
> > Make the kdebug macro do nothing by defining it with
> > do { if (0) no_printk(...); } while (0)
> > when not enabled.
[]
> Did you consider doing this within no_printk()?
Yes.
> That would break code
> which is relying on side-effects in the evaluation of a printk arg but
> that's pretty weird and I bet there isn't (and won't be) such code.
I'll bet you there is more than a little and I don't want to
experiment with it unconditionally.
All printks would need to be evaluated for that side-effect.
Safer would be to create a new no_eval_printk macro and convert
the no_printk uses over to that as appropriate and possibly create
a CONFIG_ option to use no_eval_printk instead of no_printk/printk
and let the adventurous find the side-effects.
Maybe a coccinelle script can be written to find all the locations
with evaluated non-constant expression arguments with side-effects.
next prev parent reply other threads:[~2015-08-25 20:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 16:53 [PATCH] cred: Remove unnecessary kdebug atomic reads Joe Perches
2015-08-25 20:39 ` Andrew Morton
2015-08-25 20:51 ` Joe Perches [this message]
2015-08-25 20:56 ` Andrew Morton
2015-08-25 21:10 ` Joe Perches
2015-08-25 23:30 ` David Howells
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=1440535866.2670.164.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.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