diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-05-26 18:50:31 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-06-19 09:18:27 -0400 |
commit | c74441a17eb975b604e339ca6c11b9ab9aaca11f (patch) | |
tree | 4f58ae369bac98352a65a9c47f4c83ba3ffd9b05 | |
parent | 0eeda71bc30d74f66f8231f45621d5ace3419186 (diff) |
timer: Stats: Simplify the flags handling
Simplify the handling of the flag storage for the timer statistics. No
intermediate storage anymore. Just hand over the flags field.
I left the printout of 'deferrable' for now because changing this
would be an ABI update and I have no idea how strong people feel about
that. OTOH, I wonder whether we should kill the whole timer stats
stuff because all of that information can be retrieved via ftrace/perf
as well.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Joonwoo Park <joonwoop@codeaurora.org>
Cc: Wenbo Wang <wenbo.wang@memblaze.com>
Link: http://lkml.kernel.org/r/20150526224512.046626248@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/timer.h | 5 | ||||
-rw-r--r-- | kernel/time/timer.c | 7 | ||||
-rw-r--r-- | kernel/time/timer_stats.c | 10 |
3 files changed, 8 insertions, 14 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h index 4a0d52bc2073..ff0689b6e297 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -188,13 +188,10 @@ extern void set_timer_slack(struct timer_list *time, int slack_hz); | |||
188 | 188 | ||
189 | extern int timer_stats_active; | 189 | extern int timer_stats_active; |
190 | 190 | ||
191 | #define TIMER_STATS_FLAG_DEFERRABLE 0x1 | ||
192 | |||
193 | extern void init_timer_stats(void); | 191 | extern void init_timer_stats(void); |
194 | 192 | ||
195 | extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, | 193 | extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf, |
196 | void *timerf, char *comm, | 194 | void *timerf, char *comm, u32 flags); |
197 | unsigned int timer_flag); | ||
198 | 195 | ||
199 | extern void __timer_stats_timer_set_start_info(struct timer_list *timer, | 196 | extern void __timer_stats_timer_set_start_info(struct timer_list *timer, |
200 | void *addr); | 197 | void *addr); |
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 1540af9f62eb..3398d93c74a7 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
@@ -404,15 +404,12 @@ void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr) | |||
404 | 404 | ||
405 | static void timer_stats_account_timer(struct timer_list *timer) | 405 | static void timer_stats_account_timer(struct timer_list *timer) |
406 | { | 406 | { |
407 | unsigned int flag = 0; | ||
408 | |||
409 | if (likely(!timer->start_site)) | 407 | if (likely(!timer->start_site)) |
410 | return; | 408 | return; |
411 | if (unlikely(timer->flags & TIMER_DEFERRABLE)) | ||
412 | flag |= TIMER_STATS_FLAG_DEFERRABLE; | ||
413 | 409 | ||
414 | timer_stats_update_stats(timer, timer->start_pid, timer->start_site, | 410 | timer_stats_update_stats(timer, timer->start_pid, timer->start_site, |
415 | timer->function, timer->start_comm, flag); | 411 | timer->function, timer->start_comm, |
412 | timer->flags); | ||
416 | } | 413 | } |
417 | 414 | ||
418 | #else | 415 | #else |
diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c index 1fb08f21302e..1adecb4b87c8 100644 --- a/kernel/time/timer_stats.c +++ b/kernel/time/timer_stats.c | |||
@@ -68,7 +68,7 @@ struct entry { | |||
68 | * Number of timeout events: | 68 | * Number of timeout events: |
69 | */ | 69 | */ |
70 | unsigned long count; | 70 | unsigned long count; |
71 | unsigned int timer_flag; | 71 | u32 flags; |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * We save the command-line string to preserve | 74 | * We save the command-line string to preserve |
@@ -227,13 +227,13 @@ static struct entry *tstat_lookup(struct entry *entry, char *comm) | |||
227 | * @startf: pointer to the function which did the timer setup | 227 | * @startf: pointer to the function which did the timer setup |
228 | * @timerf: pointer to the timer callback function of the timer | 228 | * @timerf: pointer to the timer callback function of the timer |
229 | * @comm: name of the process which set up the timer | 229 | * @comm: name of the process which set up the timer |
230 | * @tflags: The flags field of the timer | ||
230 | * | 231 | * |
231 | * When the timer is already registered, then the event counter is | 232 | * When the timer is already registered, then the event counter is |
232 | * incremented. Otherwise the timer is registered in a free slot. | 233 | * incremented. Otherwise the timer is registered in a free slot. |
233 | */ | 234 | */ |
234 | void timer_stats_update_stats(void *timer, pid_t pid, void *startf, | 235 | void timer_stats_update_stats(void *timer, pid_t pid, void *startf, |
235 | void *timerf, char *comm, | 236 | void *timerf, char *comm, u32 tflags) |
236 | unsigned int timer_flag) | ||
237 | { | 237 | { |
238 | /* | 238 | /* |
239 | * It doesn't matter which lock we take: | 239 | * It doesn't matter which lock we take: |
@@ -251,7 +251,7 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf, | |||
251 | input.start_func = startf; | 251 | input.start_func = startf; |
252 | input.expire_func = timerf; | 252 | input.expire_func = timerf; |
253 | input.pid = pid; | 253 | input.pid = pid; |
254 | input.timer_flag = timer_flag; | 254 | input.flags = tflags; |
255 | 255 | ||
256 | raw_spin_lock_irqsave(lock, flags); | 256 | raw_spin_lock_irqsave(lock, flags); |
257 | if (!timer_stats_active) | 257 | if (!timer_stats_active) |
@@ -306,7 +306,7 @@ static int tstats_show(struct seq_file *m, void *v) | |||
306 | 306 | ||
307 | for (i = 0; i < nr_entries; i++) { | 307 | for (i = 0; i < nr_entries; i++) { |
308 | entry = entries + i; | 308 | entry = entries + i; |
309 | if (entry->timer_flag & TIMER_STATS_FLAG_DEFERRABLE) { | 309 | if (entry->flags & TIMER_DEFERRABLE) { |
310 | seq_printf(m, "%4luD, %5d %-16s ", | 310 | seq_printf(m, "%4luD, %5d %-16s ", |
311 | entry->count, entry->pid, entry->comm); | 311 | entry->count, entry->pid, entry->comm); |
312 | } else { | 312 | } else { |