tracing: Annotate event field-defining functions with __init
authorLi Zefan <lizefan@huawei.com>
Thu, 21 Feb 2013 02:33:33 +0000 (10:33 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:34:51 +0000 (00:34 -0400)
Those functions are called either during kernel boot or module init.

Before:

$ dmesg | grep 'Freeing unused kernel memory'
Freeing unused kernel memory: 1208k freed
Freeing unused kernel memory: 1360k freed
Freeing unused kernel memory: 1960k freed

After:

$ dmesg | grep 'Freeing unused kernel memory'
Freeing unused kernel memory: 1236k freed
Freeing unused kernel memory: 1388k freed
Freeing unused kernel memory: 1960k freed

Link: http://lkml.kernel.org/r/5125877D.5000201@huawei.com
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/trace/ftrace.h
kernel/trace/trace_export.c

index 17a77fcac2a2c62eaf87780c5ea35766621ca598..a536f66f84c611f91b8e36cebbbab95344fa9c6c 100644 (file)
@@ -324,7 +324,7 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = {      \
 
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)   \
-static int notrace                                                     \
+static int notrace __init                                              \
 ftrace_define_fields_##call(struct ftrace_event_call *event_call)      \
 {                                                                      \
        struct ftrace_raw_##call field;                                 \
index e039906b037df1fbdd9f50d22b59a650921b4a3a..4f6a91c1370c7c2bd2c6eb1accf0dc5be0c472c9 100644 (file)
@@ -129,7 +129,7 @@ static void __always_unused ____ftrace_check_##name(void)           \
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter)    \
-int                                                                    \
+static int __init                                                      \
 ftrace_define_fields_##name(struct ftrace_event_call *event_call)      \
 {                                                                      \
        struct struct_name field;                                       \