Skip to content

Commit 614a71a

Browse files
Li Zefanfweisbec
authored andcommitted
tracing: Pull up calls to trace_define_common_fields()
Call trace_define_common_fields() in event_create_dir() only. This avoids trace events to handle it from their define_fields callbacks and shrinks the kernel code size: text data bss dec hex filename 5346802 1961864 7103260 14411926 dbe896 vmlinux.o.old 5345151 1961864 7103260 14410275 dbe223 vmlinux.o Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jason Baron <jbaron@redhat.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> LKML-Reference: <4B1DC49C.8000107@cn.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
1 parent 87d9b4e commit 614a71a

6 files changed

Lines changed: 4 additions & 28 deletions

File tree

‎include/linux/ftrace_event.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ enum {
159159
};
160160

161161
extern int trace_event_raw_init(struct ftrace_event_call *call);
162-
extern int trace_define_common_fields(struct ftrace_event_call *call);
163162
extern int trace_define_field(struct ftrace_event_call *call, const char *type,
164163
const char *name, int offset, int size,
165164
int is_signed, int filter_type);

‎include/trace/ftrace.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,6 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
436436
struct ftrace_raw_##call field; \
437437
int ret; \
438438
\
439-
ret = trace_define_common_fields(event_call); \
440-
if (ret) \
441-
return ret; \
442-
\
443439
tstruct; \
444440
\
445441
return ret; \

‎kernel/trace/trace_events.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(trace_define_field);
7878
if (ret) \
7979
return ret;
8080

81-
int trace_define_common_fields(struct ftrace_event_call *call)
81+
static int trace_define_common_fields(struct ftrace_event_call *call)
8282
{
8383
int ret;
8484
struct trace_entry ent;
@@ -91,7 +91,6 @@ int trace_define_common_fields(struct ftrace_event_call *call)
9191

9292
return ret;
9393
}
94-
EXPORT_SYMBOL_GPL(trace_define_common_fields);
9594

9695
void trace_destroy_fields(struct ftrace_event_call *call)
9796
{
@@ -927,7 +926,9 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
927926
id);
928927

929928
if (call->define_fields) {
930-
ret = call->define_fields(call);
929+
ret = trace_define_common_fields(call);
930+
if (!ret)
931+
ret = call->define_fields(call);
931932
if (ret < 0) {
932933
pr_warning("Could not initialize trace point"
933934
" events/%s\n", call->name);

‎kernel/trace/trace_export.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
184184
struct struct_name field; \
185185
int ret; \
186186
\
187-
ret = trace_define_common_fields(event_call); \
188-
if (ret) \
189-
return ret; \
190-
\
191187
tstruct; \
192188
\
193189
return ret; \

‎kernel/trace/trace_kprobe.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,10 +1113,6 @@ static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
11131113
struct kprobe_trace_entry field;
11141114
struct trace_probe *tp = (struct trace_probe *)event_call->data;
11151115

1116-
ret = trace_define_common_fields(event_call);
1117-
if (!ret)
1118-
return ret;
1119-
11201116
DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
11211117
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);
11221118
/* Set argument names as fields */
@@ -1131,10 +1127,6 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
11311127
struct kretprobe_trace_entry field;
11321128
struct trace_probe *tp = (struct trace_probe *)event_call->data;
11331129

1134-
ret = trace_define_common_fields(event_call);
1135-
if (!ret)
1136-
return ret;
1137-
11381130
DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);
11391131
DEFINE_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP, 0);
11401132
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);

‎kernel/trace/trace_syscalls.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ int syscall_enter_define_fields(struct ftrace_event_call *call)
217217
int i;
218218
int offset = offsetof(typeof(trace), args);
219219

220-
ret = trace_define_common_fields(call);
221-
if (ret)
222-
return ret;
223-
224220
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
225221
if (ret)
226222
return ret;
@@ -241,10 +237,6 @@ int syscall_exit_define_fields(struct ftrace_event_call *call)
241237
struct syscall_trace_exit trace;
242238
int ret;
243239

244-
ret = trace_define_common_fields(call);
245-
if (ret)
246-
return ret;
247-
248240
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
249241
if (ret)
250242
return ret;

0 commit comments

Comments
 (0)