Commit 1dc43cf0 authored by Jiri Slaby's avatar Jiri Slaby Committed by Steven Rostedt

ftrace: Cleanup of global variables ftrace_new_pgs and ftrace_update_cnt

Some of them can be local to functions, so make them local and pass
them as parameters where needed:
* __start_mcount_loc+__stop_mcount_loc are local to ftrace_init
* ftrace_new_pgs -> new_pgs/start_pg
* ftrace_update_cnt -> local update_cnt in ftrace_update_code

Link: http://lkml.kernel.org/r/1393268401-24379-1-git-send-email-jslaby@suse.czSigned-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 114e7b52
...@@ -1174,8 +1174,6 @@ struct ftrace_page { ...@@ -1174,8 +1174,6 @@ struct ftrace_page {
int size; int size;
}; };
static struct ftrace_page *ftrace_new_pgs;
#define ENTRY_SIZE sizeof(struct dyn_ftrace) #define ENTRY_SIZE sizeof(struct dyn_ftrace)
#define ENTRIES_PER_PAGE (PAGE_SIZE / ENTRY_SIZE) #define ENTRIES_PER_PAGE (PAGE_SIZE / ENTRY_SIZE)
...@@ -2246,7 +2244,6 @@ static void ftrace_shutdown_sysctl(void) ...@@ -2246,7 +2244,6 @@ static void ftrace_shutdown_sysctl(void)
} }
static cycle_t ftrace_update_time; static cycle_t ftrace_update_time;
static unsigned long ftrace_update_cnt;
unsigned long ftrace_update_tot_cnt; unsigned long ftrace_update_tot_cnt;
static inline int ops_traces_mod(struct ftrace_ops *ops) static inline int ops_traces_mod(struct ftrace_ops *ops)
...@@ -2302,11 +2299,12 @@ static int referenced_filters(struct dyn_ftrace *rec) ...@@ -2302,11 +2299,12 @@ static int referenced_filters(struct dyn_ftrace *rec)
return cnt; return cnt;
} }
static int ftrace_update_code(struct module *mod) static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs)
{ {
struct ftrace_page *pg; struct ftrace_page *pg;
struct dyn_ftrace *p; struct dyn_ftrace *p;
cycle_t start, stop; cycle_t start, stop;
unsigned long update_cnt = 0;
unsigned long ref = 0; unsigned long ref = 0;
bool test = false; bool test = false;
int i; int i;
...@@ -2332,9 +2330,8 @@ static int ftrace_update_code(struct module *mod) ...@@ -2332,9 +2330,8 @@ static int ftrace_update_code(struct module *mod)
} }
start = ftrace_now(raw_smp_processor_id()); start = ftrace_now(raw_smp_processor_id());
ftrace_update_cnt = 0;
for (pg = ftrace_new_pgs; pg; pg = pg->next) { for (pg = new_pgs; pg; pg = pg->next) {
for (i = 0; i < pg->index; i++) { for (i = 0; i < pg->index; i++) {
int cnt = ref; int cnt = ref;
...@@ -2355,7 +2352,7 @@ static int ftrace_update_code(struct module *mod) ...@@ -2355,7 +2352,7 @@ static int ftrace_update_code(struct module *mod)
if (!ftrace_code_disable(mod, p)) if (!ftrace_code_disable(mod, p))
break; break;
ftrace_update_cnt++; update_cnt++;
/* /*
* If the tracing is enabled, go ahead and enable the record. * If the tracing is enabled, go ahead and enable the record.
...@@ -2374,11 +2371,9 @@ static int ftrace_update_code(struct module *mod) ...@@ -2374,11 +2371,9 @@ static int ftrace_update_code(struct module *mod)
} }
} }
ftrace_new_pgs = NULL;
stop = ftrace_now(raw_smp_processor_id()); stop = ftrace_now(raw_smp_processor_id());
ftrace_update_time = stop - start; ftrace_update_time = stop - start;
ftrace_update_tot_cnt += ftrace_update_cnt; ftrace_update_tot_cnt += update_cnt;
return 0; return 0;
} }
...@@ -4270,9 +4265,6 @@ static int ftrace_process_locs(struct module *mod, ...@@ -4270,9 +4265,6 @@ static int ftrace_process_locs(struct module *mod,
/* Assign the last page to ftrace_pages */ /* Assign the last page to ftrace_pages */
ftrace_pages = pg; ftrace_pages = pg;
/* These new locations need to be initialized */
ftrace_new_pgs = start_pg;
/* /*
* We only need to disable interrupts on start up * We only need to disable interrupts on start up
* because we are modifying code that an interrupt * because we are modifying code that an interrupt
...@@ -4283,7 +4275,7 @@ static int ftrace_process_locs(struct module *mod, ...@@ -4283,7 +4275,7 @@ static int ftrace_process_locs(struct module *mod,
*/ */
if (!mod) if (!mod)
local_irq_save(flags); local_irq_save(flags);
ftrace_update_code(mod); ftrace_update_code(mod, start_pg);
if (!mod) if (!mod)
local_irq_restore(flags); local_irq_restore(flags);
ret = 0; ret = 0;
...@@ -4392,11 +4384,10 @@ struct notifier_block ftrace_module_exit_nb = { ...@@ -4392,11 +4384,10 @@ struct notifier_block ftrace_module_exit_nb = {
.priority = INT_MIN, /* Run after anything that can remove kprobes */ .priority = INT_MIN, /* Run after anything that can remove kprobes */
}; };
extern unsigned long __start_mcount_loc[];
extern unsigned long __stop_mcount_loc[];
void __init ftrace_init(void) void __init ftrace_init(void)
{ {
extern unsigned long __start_mcount_loc[];
extern unsigned long __stop_mcount_loc[];
unsigned long count, addr, flags; unsigned long count, addr, flags;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment