From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH v2 3/3] trace: Replace single-character seq_puts with seq_putc
Date: Sat, 8 Nov 2014 21:42:12 +0100 [thread overview]
Message-ID: <1415479332-25944-4-git-send-email-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <1415479332-25944-1-git-send-email-linux@rasmusvillemoes.dk>
Printing a single character to a seqfile might as well be done with
seq_putc instead of seq_puts; this avoids a strlen() call and a memory
access. It also shaves another few bytes off the generated code.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
kernel/trace/ftrace.c | 2 +-
kernel/trace/trace_events_trigger.c | 4 ++--
kernel/trace/trace_functions_graph.c | 4 ++--
kernel/trace/trace_kprobe.c | 10 +++++-----
kernel/trace/trace_printk.c | 2 +-
kernel/trace/trace_uprobe.c | 4 ++--
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7890718..9ffd006 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2969,7 +2969,7 @@ static int t_show(struct seq_file *m, void *v)
}
}
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
return 0;
}
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 3d89ffc..8712df9 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -383,7 +383,7 @@ event_trigger_print(const char *name, struct seq_file *m,
if (filter_str)
seq_printf(m, " if %s\n", filter_str);
else
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
return 0;
}
@@ -1105,7 +1105,7 @@ event_enable_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
if (data->filter_str)
seq_printf(m, " if %s\n", data->filter_str);
else
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
return 0;
}
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 29ba611..a82d1d3 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1407,7 +1407,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
print_lat_header(s, flags);
/* 1st line */
- seq_puts(s, "#");
+ seq_putc(s, '#');
if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
seq_puts(s, " TIME ");
if (flags & TRACE_GRAPH_PRINT_CPU)
@@ -1421,7 +1421,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
seq_puts(s, " FUNCTION CALLS\n");
/* 2nd line */
- seq_puts(s, "#");
+ seq_putc(s, '#');
if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
seq_puts(s, " | ");
if (flags & TRACE_GRAPH_PRINT_CPU)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index ce2ea71..ef7e7f1 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -840,7 +840,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
for (i = 0; i < tk->tp.nr_args; i++)
seq_printf(m, " %s=%s", tk->tp.args[i].name, tk->tp.args[i].comm);
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
return 0;
}
@@ -1030,7 +1030,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
goto partial;
- if (!trace_seq_puts(s, ")"))
+ if (!trace_seq_putc(s, ')'))
goto partial;
data = (u8 *)&field[1];
@@ -1039,7 +1039,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
data + tp->args[i].offset, field))
goto partial;
- if (!trace_seq_puts(s, "\n"))
+ if (!trace_seq_putc(s, '\n'))
goto partial;
return TRACE_TYPE_HANDLED;
@@ -1072,7 +1072,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
goto partial;
- if (!trace_seq_puts(s, ")"))
+ if (!trace_seq_putc(s, ')'))
goto partial;
data = (u8 *)&field[1];
@@ -1081,7 +1081,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
data + tp->args[i].offset, field))
goto partial;
- if (!trace_seq_puts(s, "\n"))
+ if (!trace_seq_putc(s, '\n'))
goto partial;
return TRACE_TYPE_HANDLED;
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 2900817..c4e70b6 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -305,7 +305,7 @@ static int t_show(struct seq_file *m, void *v)
seq_puts(m, "\\t");
break;
case '\\':
- seq_puts(m, "\\");
+ seq_putc(m, '\\');
break;
case '"':
seq_puts(m, "\\\"");
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 184aec1..e35327c 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -606,7 +606,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
for (i = 0; i < tu->tp.nr_args; i++)
seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm);
- seq_puts(m, "\n");
+ seq_putc(m, '\n');
return 0;
}
@@ -872,7 +872,7 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
goto partial;
}
- if (trace_seq_puts(s, "\n"))
+ if (trace_seq_putc(s, '\n'))
return TRACE_TYPE_HANDLED;
partial:
--
2.0.4
next prev parent reply other threads:[~2014-11-08 20:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-12 9:25 [PATCH 0/6] Small seqfile-use improvements Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 1/6] Coccinelle: Semantic patch for replacing puts with putc Rasmus Villemoes
2014-09-12 11:08 ` SF Markus Elfring
2014-09-12 9:25 ` [PATCH 2/6] Coccinelle: Semantic patch for joining seq_puts calls Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 3/6] Coccinelle: Semantic patch for replacing seq_printf calls with equivalent but simpler functions Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 4/6] trace: Replace seq_printf by simpler equivalents Rasmus Villemoes
2014-11-05 22:34 ` Steven Rostedt
2014-11-05 22:44 ` Rasmus Villemoes
2014-11-06 0:34 ` Steven Rostedt
2014-11-05 22:51 ` Joe Perches
2014-11-06 0:38 ` Steven Rostedt
2014-11-06 0:47 ` Joe Perches
2014-11-08 20:42 ` [PATCH v2 0/3] trace: Use simpler seq_file functions Rasmus Villemoes
2014-11-08 20:42 ` [PATCH v2 1/3] trace: Replace seq_printf by simpler equivalents Rasmus Villemoes
2014-11-14 2:31 ` Steven Rostedt
2014-11-08 20:42 ` [PATCH v2 2/3] trace: Merge consecutive seq_puts calls Rasmus Villemoes
2014-11-08 20:42 ` Rasmus Villemoes [this message]
2014-11-14 2:34 ` [PATCH v2 3/3] trace: Replace single-character seq_puts with seq_putc Steven Rostedt
2014-09-12 9:25 ` [PATCH 5/6] trace: Merge consecutive seq_puts calls Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 6/6] trace: Replace single-character seq_puts with seq_putc Rasmus Villemoes
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=1415479332-25944-4-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®