From: Joe Perches <joe@perches.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched/debug: Reduce SEQ_printf footprint
Date: Fri, 17 Apr 2015 11:39:28 -0700 [thread overview]
Message-ID: <1429295968.2850.105.camel@perches.com> (raw)
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:
next reply other threads:[~2015-04-17 18:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 18:39 Joe Perches [this message]
2015-04-17 19:22 ` [PATCH] sched/debug: Reduce SEQ_printf footprint Joe Perches
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=1429295968.2850.105.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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