diff options
| author | Jiri Slaby <jslaby@suse.cz> | 2014-02-24 13:59:56 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2014-03-07 10:06:12 -0500 |
| commit | 1dc43cf0be9a94a6a7273db284152db15c526106 (patch) | |
| tree | 4db011bc7595eca752582950aabdcb2c7ca5d374 /kernel/trace | |
| parent | 114e7b52dee69ce47dd55b8e520e0a48ba7cdae3 (diff) | |
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.cz
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/ftrace.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 5313c1100d30..3f95bbeb8e8d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1174,8 +1174,6 @@ struct ftrace_page { | |||
| 1174 | int size; | 1174 | int size; |
| 1175 | }; | 1175 | }; |
| 1176 | 1176 | ||
| 1177 | static struct ftrace_page *ftrace_new_pgs; | ||
| 1178 | |||
| 1179 | #define ENTRY_SIZE sizeof(struct dyn_ftrace) | 1177 | #define ENTRY_SIZE sizeof(struct dyn_ftrace) |
| 1180 | #define ENTRIES_PER_PAGE (PAGE_SIZE / ENTRY_SIZE) | 1178 | #define ENTRIES_PER_PAGE (PAGE_SIZE / ENTRY_SIZE) |
| 1181 | 1179 | ||
| @@ -2246,7 +2244,6 @@ static void ftrace_shutdown_sysctl(void) | |||
| 2246 | } | 2244 | } |
| 2247 | 2245 | ||
| 2248 | static cycle_t ftrace_update_time; | 2246 | static cycle_t ftrace_update_time; |
| 2249 | static unsigned long ftrace_update_cnt; | ||
| 2250 | unsigned long ftrace_update_tot_cnt; | 2247 | unsigned long ftrace_update_tot_cnt; |
| 2251 | 2248 | ||
| 2252 | static inline int ops_traces_mod(struct ftrace_ops *ops) | 2249 | static inline int ops_traces_mod(struct ftrace_ops *ops) |
| @@ -2302,11 +2299,12 @@ static int referenced_filters(struct dyn_ftrace *rec) | |||
| 2302 | return cnt; | 2299 | return cnt; |
| 2303 | } | 2300 | } |
| 2304 | 2301 | ||
| 2305 | static int ftrace_update_code(struct module *mod) | 2302 | static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs) |
| 2306 | { | 2303 | { |
| 2307 | struct ftrace_page *pg; | 2304 | struct ftrace_page *pg; |
| 2308 | struct dyn_ftrace *p; | 2305 | struct dyn_ftrace *p; |
| 2309 | cycle_t start, stop; | 2306 | cycle_t start, stop; |
| 2307 | unsigned long update_cnt = 0; | ||
| 2310 | unsigned long ref = 0; | 2308 | unsigned long ref = 0; |
| 2311 | bool test = false; | 2309 | bool test = false; |
| 2312 | int i; | 2310 | int i; |
| @@ -2332,9 +2330,8 @@ static int ftrace_update_code(struct module *mod) | |||
| 2332 | } | 2330 | } |
| 2333 | 2331 | ||
| 2334 | start = ftrace_now(raw_smp_processor_id()); | 2332 | start = ftrace_now(raw_smp_processor_id()); |
| 2335 | ftrace_update_cnt = 0; | ||
| 2336 | 2333 | ||
| 2337 | for (pg = ftrace_new_pgs; pg; pg = pg->next) { | 2334 | for (pg = new_pgs; pg; pg = pg->next) { |
| 2338 | 2335 | ||
| 2339 | for (i = 0; i < pg->index; i++) { | 2336 | for (i = 0; i < pg->index; i++) { |
| 2340 | int cnt = ref; | 2337 | int cnt = ref; |
| @@ -2355,7 +2352,7 @@ static int ftrace_update_code(struct module *mod) | |||
| 2355 | if (!ftrace_code_disable(mod, p)) | 2352 | if (!ftrace_code_disable(mod, p)) |
| 2356 | break; | 2353 | break; |
| 2357 | 2354 | ||
| 2358 | ftrace_update_cnt++; | 2355 | update_cnt++; |
| 2359 | 2356 | ||
| 2360 | /* | 2357 | /* |
| 2361 | * If the tracing is enabled, go ahead and enable the record. | 2358 | * If the tracing is enabled, go ahead and enable the record. |
| @@ -2374,11 +2371,9 @@ static int ftrace_update_code(struct module *mod) | |||
| 2374 | } | 2371 | } |
| 2375 | } | 2372 | } |
| 2376 | 2373 | ||
| 2377 | ftrace_new_pgs = NULL; | ||
| 2378 | |||
| 2379 | stop = ftrace_now(raw_smp_processor_id()); | 2374 | stop = ftrace_now(raw_smp_processor_id()); |
| 2380 | ftrace_update_time = stop - start; | 2375 | ftrace_update_time = stop - start; |
| 2381 | ftrace_update_tot_cnt += ftrace_update_cnt; | 2376 | ftrace_update_tot_cnt += update_cnt; |
| 2382 | 2377 | ||
| 2383 | return 0; | 2378 | return 0; |
| 2384 | } | 2379 | } |
| @@ -4270,9 +4265,6 @@ static int ftrace_process_locs(struct module *mod, | |||
| 4270 | /* Assign the last page to ftrace_pages */ | 4265 | /* Assign the last page to ftrace_pages */ |
| 4271 | ftrace_pages = pg; | 4266 | ftrace_pages = pg; |
| 4272 | 4267 | ||
| 4273 | /* These new locations need to be initialized */ | ||
| 4274 | ftrace_new_pgs = start_pg; | ||
| 4275 | |||
| 4276 | /* | 4268 | /* |
| 4277 | * We only need to disable interrupts on start up | 4269 | * We only need to disable interrupts on start up |
| 4278 | * because we are modifying code that an interrupt | 4270 | * because we are modifying code that an interrupt |
| @@ -4283,7 +4275,7 @@ static int ftrace_process_locs(struct module *mod, | |||
| 4283 | */ | 4275 | */ |
| 4284 | if (!mod) | 4276 | if (!mod) |
| 4285 | local_irq_save(flags); | 4277 | local_irq_save(flags); |
| 4286 | ftrace_update_code(mod); | 4278 | ftrace_update_code(mod, start_pg); |
| 4287 | if (!mod) | 4279 | if (!mod) |
| 4288 | local_irq_restore(flags); | 4280 | local_irq_restore(flags); |
| 4289 | ret = 0; | 4281 | ret = 0; |
| @@ -4392,11 +4384,10 @@ struct notifier_block ftrace_module_exit_nb = { | |||
| 4392 | .priority = INT_MIN, /* Run after anything that can remove kprobes */ | 4384 | .priority = INT_MIN, /* Run after anything that can remove kprobes */ |
| 4393 | }; | 4385 | }; |
| 4394 | 4386 | ||
| 4395 | extern unsigned long __start_mcount_loc[]; | ||
| 4396 | extern unsigned long __stop_mcount_loc[]; | ||
| 4397 | |||
| 4398 | void __init ftrace_init(void) | 4387 | void __init ftrace_init(void) |
| 4399 | { | 4388 | { |
| 4389 | extern unsigned long __start_mcount_loc[]; | ||
| 4390 | extern unsigned long __stop_mcount_loc[]; | ||
| 4400 | unsigned long count, addr, flags; | 4391 | unsigned long count, addr, flags; |
| 4401 | int ret; | 4392 | int ret; |
| 4402 | 4393 | ||
