netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlink: NL_SET_ERR_MSG - remove local static array
@ 2021-08-09 17:04 Joe Perches
  2021-08-09 22:30 ` Jonathan Toppins
  2021-08-10 20:30 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Perches @ 2021-08-09 17:04 UTC (permalink / raw)
  To: netdev; +Cc: Johannes Berg, Jonathan Toppins, LKML

The want was to have some separate object section for netlink messages
so all netlink messages could be specifically listed by some tool but
the effect is duplicating static const char arrays in the object code.

It seems unused presently so change the macro to avoid the local static
declarations until such time as these actually are wanted and used.

This reduces object size ~8KB in an x86-64 defconfig without modules.

$ size vmlinux.o*
   text	   data	    bss	    dec	    hex	filename
20110471	3460344	 741760	24312575	172faff	vmlinux.o.new
20119444	3460344	 741760	24321548	1731e0c	vmlinux.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/netlink.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 61b1c7fcc401e..4bb32ae134aa8 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -89,13 +89,12 @@ struct netlink_ext_ack {
  * to the lack of an output buffer.)
  */
 #define NL_SET_ERR_MSG(extack, msg) do {		\
-	static const char __msg[] = msg;		\
 	struct netlink_ext_ack *__extack = (extack);	\
 							\
-	do_trace_netlink_extack(__msg);			\
+	do_trace_netlink_extack(msg);			\
 							\
 	if (__extack)					\
-		__extack->_msg = __msg;			\
+		__extack->_msg = msg;			\
 } while (0)
 
 #define NL_SET_ERR_MSG_MOD(extack, msg)			\
@@ -111,13 +110,12 @@ struct netlink_ext_ack {
 #define NL_SET_BAD_ATTR(extack, attr) NL_SET_BAD_ATTR_POLICY(extack, attr, NULL)
 
 #define NL_SET_ERR_MSG_ATTR_POL(extack, attr, pol, msg) do {	\
-	static const char __msg[] = msg;			\
 	struct netlink_ext_ack *__extack = (extack);		\
 								\
-	do_trace_netlink_extack(__msg);				\
+	do_trace_netlink_extack(msg);				\
 								\
 	if (__extack) {						\
-		__extack->_msg = __msg;				\
+		__extack->_msg = msg;				\
 		__extack->bad_attr = (attr);			\
 		__extack->policy = (pol);			\
 	}							\



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-11  4:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 17:04 [PATCH] netlink: NL_SET_ERR_MSG - remove local static array Joe Perches
2021-08-09 22:30 ` Jonathan Toppins
2021-08-10 20:30 ` Jakub Kicinski
2021-08-11  4:07   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).