public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Small seqfile-use improvements
@ 2014-09-12  9:25 Rasmus Villemoes
  2014-09-12  9:25 ` [PATCH 1/6] Coccinelle: Semantic patch for replacing puts with putc Rasmus Villemoes
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-09-12  9:25 UTC (permalink / raw)
  To: Julia Lawall, Steven Rostedt, Ingo Molnar; +Cc: linux-kernel, Rasmus Villemoes

Patches 1-3 are semantic patches for replacing certain seq_* calls
with simpler equivalents, e.g. seq_printf(m, "literal") -> seq_puts(m,
"literal"). 1 and 3 are guaranteed to preserve the semantics of the
code. 2 may change it slightly, since if the seq_file overflows midway
through a series of seq_puts calls, some of the strings have been
printed; after applying 2, it is all-or-nothing. However, consecutive
seq_puts calls with literal strings is mostly used to print long
headers, so overflow is very unlikely.

As an example, I applied these coccinelle scripts to kernel/trace/.
The net result is a nice round, but admittedly tiny, 256 byte .text
reduction.

Rasmus Villemoes (6):
  Coccinelle: Semantic patch for replacing puts with putc
  Coccinelle: Semantic patch for joining seq_puts calls
  Coccinelle: Semantic patch for replacing seq_printf calls with
    equivalent but simpler functions
  trace: Replace seq_printf by simpler equivalents
  trace: Merge consecutive seq_puts calls
  trace: Replace single-character seq_puts with seq_putc

 kernel/trace/ftrace.c                        |  30 +++---
 kernel/trace/trace.c                         |  86 ++++++++-------
 kernel/trace/trace_branch.c                  |  31 +++---
 kernel/trace/trace_events.c                  |   4 +-
 kernel/trace/trace_events_trigger.c          |   6 +-
 kernel/trace/trace_functions.c               |   2 +-
 kernel/trace/trace_functions_graph.c         |  28 ++---
 kernel/trace/trace_kprobe.c                  |  12 +--
 kernel/trace/trace_printk.c                  |   2 +-
 kernel/trace/trace_uprobe.c                  |   4 +-
 scripts/coccinelle/api/seq_printf.cocci      | 156 +++++++++++++++++++++++++++
 scripts/coccinelle/api/seq_puts_concat.cocci |  71 ++++++++++++
 scripts/coccinelle/api/seq_putsc.cocci       |  61 +++++++++++
 13 files changed, 393 insertions(+), 100 deletions(-)
 create mode 100644 scripts/coccinelle/api/seq_printf.cocci
 create mode 100644 scripts/coccinelle/api/seq_puts_concat.cocci
 create mode 100644 scripts/coccinelle/api/seq_putsc.cocci

-- 
2.0.4


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

end of thread, other threads:[~2014-11-14  2:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` [PATCH v2 3/3] trace: Replace single-character seq_puts with seq_putc Rasmus Villemoes
2014-11-14  2:34       ` 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

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