mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] timer_list: Reduce SEQ_printf footprint
@ 2015-04-17 18:39 Joe Perches
  2015-04-17 19:21 ` Joe Perches
  2015-04-22 19:03 ` [tip:timers/core] " tip-bot for Joe Perches
  0 siblings, 2 replies; 3+ messages in thread
From: Joe Perches @ 2015-04-17 18:39 UTC (permalink / raw)
  To: Thomas Gleixner, John Stultz; +Cc: LKML

This macro can be converted to a static inline to reduce
object size.

(x86-64 defconfig)
$ size kernel/time/timer_list.o*
   text	   data	    bss	    dec	    hex	filename
   4647	      8	      0	   4655	   122f	kernel/time/timer_list.o.new
   6583	      8	      0	   6591	   19bf	kernel/time/timer_list.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/time/timer_list.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index e878c2e..5960af21 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -35,13 +35,20 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
  * This allows printing both to /proc/timer_list and
  * to the console (on SysRq-Q):
  */
-#define SEQ_printf(m, x...)			\
- do {						\
-	if (m)					\
-		seq_printf(m, x);		\
-	else					\
-		printk(x);			\
- } while (0)
+__printf(2, 3)
+static void SEQ_printf(struct seq_file *m, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+
+	if (m)
+		seq_vprintf(m, fmt, args);
+	else
+		vprintk(fmt, args);
+
+	va_end(args);
+}
 
 static void print_name_offset(struct seq_file *m, void *sym)
 {



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

* Re: [PATCH] timer_list: Reduce SEQ_printf footprint
  2015-04-17 18:39 [PATCH] timer_list: Reduce SEQ_printf footprint Joe Perches
@ 2015-04-17 19:21 ` Joe Perches
  2015-04-22 19:03 ` [tip:timers/core] " tip-bot for Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2015-04-17 19:21 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: John Stultz, LKML

On Fri, 2015-04-17 at 11:39 -0700, Joe Perches wrote:
> This macro can be converted to a static inline to reduce
> object size.

bah, that should be "static function".



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

* [tip:timers/core] timer_list: Reduce SEQ_printf footprint
  2015-04-17 18:39 [PATCH] timer_list: Reduce SEQ_printf footprint Joe Perches
  2015-04-17 19:21 ` Joe Perches
@ 2015-04-22 19:03 ` tip-bot for Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Joe Perches @ 2015-04-22 19:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, hpa, mingo, linux-kernel, john.stultz, joe

Commit-ID:  7de4e74430139f2484cb16cedf6c281d1a5a696e
Gitweb:     http://git.kernel.org/tip/7de4e74430139f2484cb16cedf6c281d1a5a696e
Author:     Joe Perches <joe@perches.com>
AuthorDate: Fri, 17 Apr 2015 11:39:18 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 22 Apr 2015 12:03:39 +0200

timer_list: Reduce SEQ_printf footprint

This macro can be converted to a static function to reduce
object size.

(x86-64 defconfig)
$ size kernel/time/timer_list.o*
   text	   data	    bss	    dec	    hex	filename
   6583	      8	      0	   6591	   19bf	kernel/time/timer_list.o.old
   4647	      8	      0	   4655	   122f	kernel/time/timer_list.o.new

Signed-off-by: Joe Perches <joe@perches.com>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1429295958.2850.104.camel@perches.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/timer_list.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index e878c2e..5960af21 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -35,13 +35,20 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases);
  * This allows printing both to /proc/timer_list and
  * to the console (on SysRq-Q):
  */
-#define SEQ_printf(m, x...)			\
- do {						\
-	if (m)					\
-		seq_printf(m, x);		\
-	else					\
-		printk(x);			\
- } while (0)
+__printf(2, 3)
+static void SEQ_printf(struct seq_file *m, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+
+	if (m)
+		seq_vprintf(m, fmt, args);
+	else
+		vprintk(fmt, args);
+
+	va_end(args);
+}
 
 static void print_name_offset(struct seq_file *m, void *sym)
 {

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

end of thread, other threads:[~2015-04-22 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17 18:39 [PATCH] timer_list: Reduce SEQ_printf footprint Joe Perches
2015-04-17 19:21 ` Joe Perches
2015-04-22 19:03 ` [tip:timers/core] " tip-bot for Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome