Skip to content

Commit c74441a

Browse files
committed
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>
1 parent 0eeda71 commit c74441a

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

include/linux/timer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,10 @@ extern void set_timer_slack(struct timer_list *time, int slack_hz);
188188

189189
extern int timer_stats_active;
190190

191-
#define TIMER_STATS_FLAG_DEFERRABLE 0x1
192-
193191
extern void init_timer_stats(void);
194192

195193
extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
196-
void *timerf, char *comm,
197-
unsigned int timer_flag);
194+
void *timerf, char *comm, u32 flags);
198195

199196
extern void __timer_stats_timer_set_start_info(struct timer_list *timer,
200197
void *addr);

kernel/time/timer.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,12 @@ void __timer_stats_timer_set_start_info(struct timer_list *timer, void *addr)
404404

405405
static void timer_stats_account_timer(struct timer_list *timer)
406406
{
407-
unsigned int flag = 0;
408-
409407
if (likely(!timer->start_site))
410408
return;
411-
if (unlikely(timer->flags & TIMER_DEFERRABLE))
412-
flag |= TIMER_STATS_FLAG_DEFERRABLE;
413409

414410
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);
416413
}
417414

418415
#else

kernel/time/timer_stats.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct entry {
6868
* Number of timeout events:
6969
*/
7070
unsigned long count;
71-
unsigned int timer_flag;
71+
u32 flags;
7272

7373
/*
7474
* We save the command-line string to preserve
@@ -227,13 +227,13 @@ static struct entry *tstat_lookup(struct entry *entry, char *comm)
227227
* @startf: pointer to the function which did the timer setup
228228
* @timerf: pointer to the timer callback function of the timer
229229
* @comm: name of the process which set up the timer
230+
* @tflags: The flags field of the timer
230231
*
231232
* When the timer is already registered, then the event counter is
232233
* incremented. Otherwise the timer is registered in a free slot.
233234
*/
234235
void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
235-
void *timerf, char *comm,
236-
unsigned int timer_flag)
236+
void *timerf, char *comm, u32 tflags)
237237
{
238238
/*
239239
* It doesn't matter which lock we take:
@@ -251,7 +251,7 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
251251
input.start_func = startf;
252252
input.expire_func = timerf;
253253
input.pid = pid;
254-
input.timer_flag = timer_flag;
254+
input.flags = tflags;
255255

256256
raw_spin_lock_irqsave(lock, flags);
257257
if (!timer_stats_active)
@@ -306,7 +306,7 @@ static int tstats_show(struct seq_file *m, void *v)
306306

307307
for (i = 0; i < nr_entries; i++) {
308308
entry = entries + i;
309-
if (entry->timer_flag & TIMER_STATS_FLAG_DEFERRABLE) {
309+
if (entry->flags & TIMER_DEFERRABLE) {
310310
seq_printf(m, "%4luD, %5d %-16s ",
311311
entry->count, entry->pid, entry->comm);
312312
} else {

0 commit comments

Comments
 (0)