The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] sched/debug: Reduce SEQ_printf footprint
@ 2015-04-17 18:39 Joe Perches
  2015-04-17 19:22 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2015-04-17 18:39 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML

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

(x86-64 defconfig, with SCHED_DEBUG)

$ size kernel/sched/debug.o*
   text	   data	    bss	    dec	    hex	filename
  13885	      8	   4098	  17991	   4647	kernel/sched/debug.o.new
  20413	      8	   4098	  24519	   5fc7	kernel/sched/debug.o.old

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

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index a245c1f..c7932cc 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -25,13 +25,20 @@ static DEFINE_SPINLOCK(sched_debug_lock);
  * This allows printing both to /proc/sched_debug and
  * to the console
  */
-#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);
+}
 
 /*
  * Ease the printing of nsec fields:



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

* Re: [PATCH] sched/debug: Reduce SEQ_printf footprint
  2015-04-17 18:39 [PATCH] sched/debug: Reduce SEQ_printf footprint Joe Perches
@ 2015-04-17 19:22 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2015-04-17 19:22 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: 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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-17 18:39 [PATCH] sched/debug: Reduce SEQ_printf footprint Joe Perches
2015-04-17 19:22 ` Joe Perches

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