aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-22 11:46:44 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:20:30 -0400
commit0405ab80aa94afb13bf9ac4a6fc9f2923d4b9114 (patch)
tree43eedc09bb15ecfda26adb661d59badeacea0de6 /kernel
parent2e33af029556cb8bd22bf4f86f42d540249177ea (diff)
tracing: Move raw_init from events to class
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 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4900375 1053380 861512 6815267 67fe23 vmlinux.fields 4900382 1048964 861512 6810858 67ecea 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. Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events.c12
-rw-r--r--kernel/trace/trace_export.c2
-rw-r--r--kernel/trace/trace_kprobe.c6
-rw-r--r--kernel/trace/trace_syscalls.c2
4 files changed, 12 insertions, 10 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index acc0f55742c3..8e94255a45e7 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1008,8 +1008,8 @@ static int __trace_add_event_call(struct ftrace_event_call *call)
1008 if (!call->name) 1008 if (!call->name)
1009 return -EINVAL; 1009 return -EINVAL;
1010 1010
1011 if (call->raw_init) { 1011 if (call->class->raw_init) {
1012 ret = call->raw_init(call); 1012 ret = call->class->raw_init(call);
1013 if (ret < 0) { 1013 if (ret < 0) {
1014 if (ret != -ENOSYS) 1014 if (ret != -ENOSYS)
1015 pr_warning("Could not initialize trace " 1015 pr_warning("Could not initialize trace "
@@ -1170,8 +1170,8 @@ static void trace_module_add_events(struct module *mod)
1170 /* The linker may leave blanks */ 1170 /* The linker may leave blanks */
1171 if (!call->name) 1171 if (!call->name)
1172 continue; 1172 continue;
1173 if (call->raw_init) { 1173 if (call->class->raw_init) {
1174 ret = call->raw_init(call); 1174 ret = call->class->raw_init(call);
1175 if (ret < 0) { 1175 if (ret < 0) {
1176 if (ret != -ENOSYS) 1176 if (ret != -ENOSYS)
1177 pr_warning("Could not initialize trace " 1177 pr_warning("Could not initialize trace "
@@ -1324,8 +1324,8 @@ static __init int event_trace_init(void)
1324 /* The linker may leave blanks */ 1324 /* The linker may leave blanks */
1325 if (!call->name) 1325 if (!call->name)
1326 continue; 1326 continue;
1327 if (call->raw_init) { 1327 if (call->class->raw_init) {
1328 ret = call->raw_init(call); 1328 ret = call->class->raw_init(call);
1329 if (ret < 0) { 1329 if (ret < 0) {
1330 if (ret != -ENOSYS) 1330 if (ret != -ENOSYS)
1331 pr_warning("Could not initialize trace " 1331 pr_warning("Could not initialize trace "
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index e700a0c1803f..e878d06c0ac0 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)
158struct ftrace_event_class event_class_ftrace_##call = { \ 158struct ftrace_event_class event_class_ftrace_##call = { \
159 .system = __stringify(TRACE_SYSTEM), \ 159 .system = __stringify(TRACE_SYSTEM), \
160 .define_fields = ftrace_define_fields_##call, \ 160 .define_fields = ftrace_define_fields_##call, \
161 .raw_init = ftrace_raw_init_event, \
161}; \ 162}; \
162 \ 163 \
163struct ftrace_event_call __used \ 164struct ftrace_event_call __used \
@@ -166,7 +167,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
166 .name = #call, \ 167 .name = #call, \
167 .id = type, \ 168 .id = type, \
168 .class = &event_class_ftrace_##call, \ 169 .class = &event_class_ftrace_##call, \
169 .raw_init = ftrace_raw_init_event, \
170 .print_fmt = print, \ 170 .print_fmt = print, \
171}; \ 171}; \
172 172
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index b14bf745356f..428f4a52de69 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)
1359 /* Initialize ftrace_event_call */ 1359 /* Initialize ftrace_event_call */
1360 if (probe_is_return(tp)) { 1360 if (probe_is_return(tp)) {
1361 tp->event.trace = print_kretprobe_event; 1361 tp->event.trace = print_kretprobe_event;
1362 call->raw_init = probe_event_raw_init;
1363 INIT_LIST_HEAD(&call->class->fields); 1362 INIT_LIST_HEAD(&call->class->fields);
1363 call->class->raw_init = probe_event_raw_init;
1364 call->class->define_fields = kretprobe_event_define_fields; 1364 call->class->define_fields = kretprobe_event_define_fields;
1365 } else { 1365 } else {
1366 tp->event.trace = print_kprobe_event;
1367 call->raw_init = probe_event_raw_init;
1368 INIT_LIST_HEAD(&call->class->fields); 1366 INIT_LIST_HEAD(&call->class->fields);
1367 tp->event.trace = print_kprobe_event;
1368 call->class->raw_init = probe_event_raw_init;
1369 call->class->define_fields = kprobe_event_define_fields; 1369 call->class->define_fields = kprobe_event_define_fields;
1370 } 1370 }
1371 if (set_print_fmt(tp) < 0) 1371 if (set_print_fmt(tp) < 0)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index cceccf0d2e91..1c1b9bf3ccc6 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -44,6 +44,7 @@ struct ftrace_event_class event_class_syscall_enter = {
44 .reg = syscall_enter_register, 44 .reg = syscall_enter_register,
45 .define_fields = syscall_enter_define_fields, 45 .define_fields = syscall_enter_define_fields,
46 .get_fields = syscall_get_enter_fields, 46 .get_fields = syscall_get_enter_fields,
47 .raw_init = init_syscall_trace,
47}; 48};
48 49
49struct ftrace_event_class event_class_syscall_exit = { 50struct ftrace_event_class event_class_syscall_exit = {
@@ -51,6 +52,7 @@ struct ftrace_event_class event_class_syscall_exit = {
51 .reg = syscall_exit_register, 52 .reg = syscall_exit_register,
52 .define_fields = syscall_exit_define_fields, 53 .define_fields = syscall_exit_define_fields,
53 .get_fields = syscall_get_exit_fields, 54 .get_fields = syscall_get_exit_fields,
55 .raw_init = init_syscall_trace,
54}; 56};
55 57
56extern unsigned long __start_syscalls_metadata[]; 58extern unsigned long __start_syscalls_metadata[];