mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jason Baron <jbaron@redhat.com>
Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
	Jim Cromie <jim.cromie@gmail.com>
Subject: [RFC PATCH] dynamic_debug: Remove __used attribute from metadata
Date: Thu, 17 May 2012 13:02:38 -0700	[thread overview]
Message-ID: <1337284958.17726.51.camel@joe2Laptop> (raw)

The __used attribute in the declaration of the
dynamic_debug metadata stops the compiler from
optimizing and eliminating constant tests and
the metadata declaration used in things like:

   #define DEBUG_LEVEL 0
   if (DEBUG_LEVEL > 1)
   	pr_debug("foo...");

This is a common construct for debugging macros
with a constant "level" test.

When dynamic_debug is not configured, this is
pr_debug and format string is eliminated unless
DEBUG_LEVEL is greater than 1.

Remove the unnecessary __used attribute so the
even the dynamic_debug use of pr_debug can be
appropriately optimized away completely.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/dynamic_debug.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 7e3c53a..85cee11 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -58,7 +58,7 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
 			 const char *fmt, ...);
 
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)		\
-	static struct _ddebug __used __aligned(8)		\
+	static struct _ddebug __aligned(8)			\
 	__attribute__((section("__verbose"))) name = {		\
 		.modname = KBUILD_MODNAME,			\
 		.function = __func__,				\



             reply	other threads:[~2012-05-17 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 20:02 Joe Perches [this message]
2012-05-23 18:00 ` Jim Cromie
2012-05-23 18:10   ` Joe Perches
2012-05-23 19:06   ` Jason Baron

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=1337284958.17726.51.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=gregkh@suse.de \
    --cc=jbaron@redhat.com \
    --cc=jim.cromie@gmail.com \
    --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

all inboxes | Powered by JetHome®