From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Li Zefan <lizf@cn.fujitsu.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Christoph Hellwig <hch@lst.de>
Subject: [PATCH 06/10][RFC] tracing: Move raw_init from events to class
Date: Mon, 26 Apr 2010 15:50:30 -0400 [thread overview]
Message-ID: <20100426200242.757929062@goodmis.org> (raw)
In-Reply-To: 20100426195024.256424113@goodmis.org
[-- Attachment #1: 0006-tracing-Move-raw_init-from-events-to-class.patch --]
[-- Type: text/plain, Size: 8156 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The raw_init function pointer in the event is used to initialize
various kinds of events. The type of initialization needed is usually
classed to the kind of event it is.
Two events with the same class will always have the same initialization
function, so it makes sense to move this to the class structure.
Perhaps even making a special system structure would work since
the initialization is the same for all events within a system.
But since there's no system structure (yet), this will just move it
to the class.
text data bss dec hex filename
5788186 1337252 9351592 16477030 fb6b66 vmlinux.orig
5774567 1297492 9351592 16423651 fa9ae3 vmlinux.fields
5774510 1293204 9351592 16419306 fa89ea vmlinux.init
The text grew very slightly, but this is a constant growth that happened
with the changing of the C files that call the init code.
The bigger savings is the data which will be saved the more events share
a class.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/ftrace_event.h | 2 +-
include/linux/syscalls.h | 2 --
include/trace/ftrace.h | 8 ++++----
kernel/trace/trace_events.c | 12 ++++++------
kernel/trace/trace_export.c | 2 +-
kernel/trace/trace_kprobe.c | 6 +++---
kernel/trace/trace_syscalls.c | 2 ++
7 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 1e2c8f5..655de69 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -131,6 +131,7 @@ struct ftrace_event_class {
int (*define_fields)(struct ftrace_event_call *);
struct list_head *(*get_fields)(struct ftrace_event_call *);
struct list_head fields;
+ int (*raw_init)(struct ftrace_event_call *);
};
struct ftrace_event_call {
@@ -142,7 +143,6 @@ struct ftrace_event_call {
int enabled;
int id;
const char *print_fmt;
- int (*raw_init)(struct ftrace_event_call *);
int filter_active;
struct event_filter *filter;
void *mod;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index ef4f81c..a0db1e8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -135,7 +135,6 @@ extern struct ftrace_event_class event_class_syscall_exit;
.name = "sys_enter"#sname, \
.class = &event_class_syscall_enter, \
.event = &enter_syscall_print_##sname, \
- .raw_init = init_syscall_trace, \
.data = (void *)&__syscall_meta_##sname,\
}
@@ -153,7 +152,6 @@ extern struct ftrace_event_class event_class_syscall_exit;
.name = "sys_exit"#sname, \
.class = &event_class_syscall_exit, \
.event = &exit_syscall_print_##sname, \
- .raw_init = init_syscall_trace, \
.data = (void *)&__syscall_meta_##sname,\
}
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index e6ec392..de0d96c 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -430,8 +430,9 @@ static inline notrace int ftrace_get_offsets_##call( \
* static struct ftrace_event_class __used event_class_<template> = {
* .system = "<system>",
* .define_fields = ftrace_define_fields_<call>,
- .fields = LIST_HEAD_INIT(event_class_##call.fields),\
- .probe = ftrace_raw_event_##call, \
+ * .fields = LIST_HEAD_INIT(event_class_##call.fields),
+ * .raw_init = trace_event_raw_init,
+ * .probe = ftrace_raw_event_##call,
* }
*
* static struct ftrace_event_call __used
@@ -439,7 +440,6 @@ static inline notrace int ftrace_get_offsets_##call( \
* __attribute__((section("_ftrace_events"))) event_<call> = {
* .name = "<call>",
* .class = event_class_<template>,
- * .raw_init = trace_event_raw_init,
* .event = &ftrace_event_type_<call>,
* .print_fmt = print_fmt_<call>,
* }
@@ -555,6 +555,7 @@ static struct ftrace_event_class __used event_class_##call = { \
.system = __stringify(TRACE_SYSTEM), \
.define_fields = ftrace_define_fields_##call, \
.fields = LIST_HEAD_INIT(event_class_##call.fields),\
+ .raw_init = trace_event_raw_init, \
.probe = ftrace_raw_event_##call, \
_TRACE_PERF_INIT(call) \
}
@@ -568,7 +569,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
.name = #call, \
.class = &event_class_##template, \
.event = &ftrace_event_type_##call, \
- .raw_init = trace_event_raw_init, \
.print_fmt = print_fmt_##template, \
}
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index c31632e..c34a9bd 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1012,8 +1012,8 @@ static int __trace_add_event_call(struct ftrace_event_call *call)
if (!call->name)
return -EINVAL;
- if (call->raw_init) {
- ret = call->raw_init(call);
+ if (call->class->raw_init) {
+ ret = call->class->raw_init(call);
if (ret < 0) {
if (ret != -ENOSYS)
pr_warning("Could not initialize trace "
@@ -1174,8 +1174,8 @@ static void trace_module_add_events(struct module *mod)
/* The linker may leave blanks */
if (!call->name)
continue;
- if (call->raw_init) {
- ret = call->raw_init(call);
+ if (call->class->raw_init) {
+ ret = call->class->raw_init(call);
if (ret < 0) {
if (ret != -ENOSYS)
pr_warning("Could not initialize trace "
@@ -1328,8 +1328,8 @@ static __init int event_trace_init(void)
/* The linker may leave blanks */
if (!call->name)
continue;
- if (call->raw_init) {
- ret = call->raw_init(call);
+ if (call->class->raw_init) {
+ ret = call->class->raw_init(call);
if (ret < 0) {
if (ret != -ENOSYS)
pr_warning("Could not initialize trace "
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index e700a0c..e878d06 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -158,6 +158,7 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
struct ftrace_event_class event_class_ftrace_##call = { \
.system = __stringify(TRACE_SYSTEM), \
.define_fields = ftrace_define_fields_##call, \
+ .raw_init = ftrace_raw_init_event, \
}; \
\
struct ftrace_event_call __used \
@@ -166,7 +167,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
.name = #call, \
.id = type, \
.class = &event_class_ftrace_##call, \
- .raw_init = ftrace_raw_init_event, \
.print_fmt = print, \
}; \
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index b14bf74..428f4a5 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1359,13 +1359,13 @@ static int register_probe_event(struct trace_probe *tp)
/* Initialize ftrace_event_call */
if (probe_is_return(tp)) {
tp->event.trace = print_kretprobe_event;
- call->raw_init = probe_event_raw_init;
INIT_LIST_HEAD(&call->class->fields);
+ call->class->raw_init = probe_event_raw_init;
call->class->define_fields = kretprobe_event_define_fields;
} else {
- tp->event.trace = print_kprobe_event;
- call->raw_init = probe_event_raw_init;
INIT_LIST_HEAD(&call->class->fields);
+ tp->event.trace = print_kprobe_event;
+ call->class->raw_init = probe_event_raw_init;
call->class->define_fields = kprobe_event_define_fields;
}
if (set_print_fmt(tp) < 0)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index eb535ba..7ee6086 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -35,6 +35,7 @@ struct ftrace_event_class event_class_syscall_enter = {
.reg = syscall_enter_register,
.define_fields = syscall_enter_define_fields,
.get_fields = syscall_get_fields,
+ .raw_init = init_syscall_trace,
};
struct ftrace_event_class event_class_syscall_exit = {
@@ -42,6 +43,7 @@ struct ftrace_event_class event_class_syscall_exit = {
.reg = syscall_exit_register,
.define_fields = syscall_exit_define_fields,
.get_fields = syscall_get_fields,
+ .raw_init = init_syscall_trace,
};
extern unsigned long __start_syscalls_metadata[];
--
1.7.0
next prev parent reply other threads:[~2010-04-26 20:02 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 19:50 [PATCH 00/10][RFC] tracing: Lowering the footprint of TRACE_EVENTs Steven Rostedt
2010-04-26 19:50 ` [PATCH 01/10][RFC] tracing: Create class struct for events Steven Rostedt
2010-04-28 20:22 ` Mathieu Desnoyers
2010-04-28 20:38 ` Steven Rostedt
2010-04-26 19:50 ` [PATCH 02/10][RFC] tracing: Let tracepoints have data passed to tracepoint callbacks Steven Rostedt
2010-04-27 9:08 ` Li Zefan
2010-04-27 15:28 ` Steven Rostedt
2010-04-28 20:37 ` Mathieu Desnoyers
2010-04-28 23:56 ` Steven Rostedt
2010-04-26 19:50 ` [PATCH 03/10][RFC] tracing: Convert TRACE_EVENT() to use the DECLARE_TRACE_DATA() Steven Rostedt
2010-04-28 20:39 ` Mathieu Desnoyers
2010-04-28 23:57 ` Steven Rostedt
2010-04-29 0:03 ` Mathieu Desnoyers
2010-04-26 19:50 ` [PATCH 04/10][RFC] tracing: Remove per event trace registering Steven Rostedt
2010-04-28 20:44 ` Mathieu Desnoyers
2010-04-29 0:00 ` Steven Rostedt
2010-04-29 0:05 ` Mathieu Desnoyers
2010-04-29 0:20 ` Steven Rostedt
[not found] ` <20100429133649.GC14617@Krystal>
2010-04-29 14:06 ` Steven Rostedt
2010-04-29 14:55 ` Mathieu Desnoyers
2010-04-29 16:06 ` Steven Rostedt
2010-04-30 17:09 ` Mathieu Desnoyers
2010-04-30 18:16 ` Steven Rostedt
2010-04-30 19:06 ` Mathieu Desnoyers
2010-04-30 19:48 ` Steven Rostedt
2010-04-30 20:07 ` Mathieu Desnoyers
2010-04-30 20:14 ` Steven Rostedt
2010-04-30 21:02 ` Mathieu Desnoyers
2010-04-26 19:50 ` [PATCH 05/10][RFC] tracing: Move fields from event to class structure Steven Rostedt
2010-04-28 20:58 ` Mathieu Desnoyers
2010-04-29 0:02 ` Steven Rostedt
[not found] ` <20100429133213.GA14617@Krystal>
2010-04-29 13:50 ` Steven Rostedt
2010-04-26 19:50 ` Steven Rostedt [this message]
2010-04-28 21:00 ` [PATCH 06/10][RFC] tracing: Move raw_init from events to class Mathieu Desnoyers
2010-04-26 19:50 ` [PATCH 07/10][RFC] tracing: Allow events to share their print functions Steven Rostedt
2010-04-28 21:03 ` Mathieu Desnoyers
2010-04-26 19:50 ` [PATCH 08/10][RFC] tracing: Move print functions into event class Steven Rostedt
2010-04-28 21:03 ` Mathieu Desnoyers
2010-04-26 19:50 ` [PATCH 09/10][RFC] tracing: Remove duplicate id information in event structure Steven Rostedt
2010-04-28 21:06 ` Mathieu Desnoyers
2010-04-29 0:04 ` Steven Rostedt
2010-04-26 19:50 ` [PATCH 10/10][RFC] tracing: Combine event filter_active and enable into single flags field Steven Rostedt
2010-04-28 21:13 ` Mathieu Desnoyers
2010-04-28 14:45 ` [PATCH 00/10][RFC] tracing: Lowering the footprint of TRACE_EVENTs Masami Hiramatsu
2010-04-28 20:18 ` Mathieu Desnoyers
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=20100426200242.757929062@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=fweisbec@gmail.com \
--cc=hch@lst.de \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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