Skip to contentSkip to conversation

dynamic_debug: Remove unnecessary __used

PATCH In review Joe Perches 3 participants 5 messages Oct 18, 2012 Dynamic debug

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dynamic_debug: Remove unnecessary __used

The __used attribute prevents gcc from eliminating unnecessary, otherwise optimized away, metadata for debugging logging messages.

Remove the __used attribute.

---
 include/linux/dynamic_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +1 -1
index c18257b..6dd4787 100644
@@ -61,7 +61,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__,				\
#1 lore raw
Quoted 5 lines · Joe Perches

The __used attribute prevents gcc from eliminating unnecessary, otherwise optimized away, metadata for debugging logging messages.

Remove the __used attribute.

Very cool. Any idea how much space this saves?

greg k-h

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 5 lines · Joe Perches

The __used attribute prevents gcc from eliminating unnecessary, otherwise optimized away, metadata for debugging logging messages.

Remove the __used attribute.

Very cool. Any idea how much space this saves?

Dunno, it's been a while since I did an allyesconfig on my netbook, my recollection is that was a few hundred kb.

https://lkml.org/lkml/2012/5/17/340

Acked-by on v1 1/1
#3 lore raw
In reply to Joe Perches
Quoted 18 lines · Joe Perches

The __used attribute prevents gcc from eliminating unnecessary, otherwise optimized away, metadata for debugging logging messages.

Remove the __used attribute.

---
 include/linux/dynamic_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +0 -0
index c18257b..6dd4787 100644

include/linux/dynamic_debug.h int __dynamic_netdev_dbg(struct _ddebug *descriptor, · line 67

Quoted 8 lines
include/linux/dynamic_debug.h +1 -1
@@ -61,7 +61,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__,				\

Greg, Pls pull this.

#4 lore raw
Quoted 19 lines · Jason Baron
Quoted 18 lines · Joe Perches

The __used attribute prevents gcc from eliminating unnecessary, otherwise optimized away, metadata for debugging logging messages.

Remove the __used attribute.

---
 include/linux/dynamic_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +0 -0
index c18257b..6dd4787 100644
@@ -61,7 +61,7 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
 			 const char *fmt, ...);
 
Quoted 10 lines

include/linux/dynamic_debug.h int __dynamic_netdev_dbg(struct _ddebug *descriptor, · line 67

Quoted 8 lines
include/linux/dynamic_debug.h +1 -1
 #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__,				\

Greg, Pls pull this.

I will, thanks.

greg "here, have a vowel or three" k-h