tracing: Clean up trace.h
PATCH 1/1 tracing: Clean up trace.h
- remove some dead code
- remove @stats from struct tracer
- move DEFINE_COMPARISON_PRED() and DEFINE_EQUALITY_PRED() to kernel/trace/trace_events_filter.c
--- kernel/trace/trace.h | 87 +++++------------------------------- kernel/trace/trace_events_filter.c | 41 +++++++++++++++++ kernel/trace/trace_selftest.c | 2 +- 3 files changed, 53 insertions(+), 77 deletions(-)
kernel/trace/trace.h +11 -76
@@ -125,14 +125,6 @@ struct print_entry {char buf[]; }; -#define TRACE_OLD_SIZE 88 - -struct trace_field_cont { -unsigned char type; -/* Temporary till we get rid of this completely */ -char buf[TRACE_OLD_SIZE -1 ]; -}; -struct trace_mmiotrace_rw {struct trace_entry ent;struct mmiotrace_rw rw;
@@ -182,20 +174,20 @@ enum kmemtrace_type_id {struct kmemtrace_alloc_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; -size_t bytes_req; -size_t bytes_alloc; -gfp_t gfp_flags; -int node; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; +size_t bytes_req; +size_t bytes_alloc; +gfp_t gfp_flags; +int node; };struct kmemtrace_free_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; };struct syscall_trace_enter {
@@ -210,7 +202,6 @@ struct syscall_trace_exit {unsigned long ret; }; -#define KSYM_SELFTEST_ENTRY "ksym_selftest_dummy"extern int process_new_ksym_entry (char *ksymname,int op,unsigned long addr);struct ksym_trace_entry {
@@ -226,7 +217,7 @@ struct ksym_trace_entry {* states when a trace occurs. These are: * IRQS_OFF - interrupts were disabled * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested +* NEED_RESCHED - reschedule is requested * HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler */
@@ -406,7 +397,6 @@ struct tracer {struct tracer *next;int print_max;struct tracer_flags *flags; -struct tracer_stat *stats; };
@@ -525,20 +515,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,extern cycle_t ftrace_now (int cpu); -#ifdef CONFIG_CONTEXT_SWITCH_TRACER -typedef void -(*tracer_switch_func_t )(void *private, -void *__rq, -struct task_struct *prev, -struct task_struct *next); - -struct tracer_switch_ops { -tracer_switch_func_t func; -void *private; -struct tracer_switch_ops *next; -}; -#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ -extern void trace_find_cmdline (int pid,char comm[]);#ifdef CONFIG_DYNAMIC_FTRACE
@@ -841,47 +817,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,return 0 ; } -#define DEFINE_COMPARISON_PRED (type) \ -static int filter_pred_##type(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - type *addr = (type *)(event + pred->offset); \ - type val = (type)pred->val; \ - int match = 0; \ - \ - switch (pred->op) { \ - case OP_LT: \ - match = (*addr < val); \ - break; \ - case OP_LE: \ - match = (*addr <= val); \ - break; \ - case OP_GT: \ - match = (*addr > val); \ - break; \ - case OP_GE: \ - match = (*addr >= val); \ - break; \ - default: \ - break; \ - } \ - \ - return match; \ -} - -#define DEFINE_EQUALITY_PRED (size) \ -static int filter_pred_##size(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - u##size *addr = (u##size *)(event + pred->offset); \ - u##size val = (u##size)pred->val; \ - int match; \ - \ - match = (val == *addr) ^ pred->not; \ - \ - return match; \ -} -extern struct mutex event_mutex;extern struct list_head ftrace_events;
kernel/trace/trace_events_filter.c +41 -0
47 lines not on this page · raw message
kernel/trace/trace_selftest.c +1 -1
@@ -828,7 +828,7 @@ trace_selftest_startup_ksym(struct tracer *trace, struct trace_array *tr) ksym_selftest_dummy =0 ;/* Register the read-write tracing request */ - ret =process_new_ksym_entry (KSYM_SELFTEST_ENTRY ,HW_BREAKPOINT_RW , + ret =process_new_ksym_entry ("ksym_selftest_dummy" ,HW_BREAKPOINT_RW , (unsigned long )(&ksym_selftest_dummy));if (ret <0 ) {
Signature · 1 line
1.6.3
Steven Rostedt
maintainerQuoted 4 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.c
Thanks Li, I'll apply it. Just curious, do you have a tool to find dead code, or is it just by review?
-- Steve
Quoted 3 lines
Signed-off-by Li Zefan <[email protected]>---
Steven Rostedt
maintainerQuoted 5 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.c
Li,
Can you break this patch up into two. I would like some of the changes to go through tip/tracing/core which does not have the hw-breakpoints code. Could you resend with two patches, one that applies to tracing/core and the other that applies to tracing/hw-breakpoints.
Thanks,
-- Steve
Quoted 9 lines · Steven Rostedt
Quoted 4 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.cThanks Li, I'll apply it. Just curious, do you have a tool to find dead code, or is it just by review?
No, no tool, otherwise I would have run it on the whole kernel tree and made tons of patches. ;)