Skip to content

Commit 5df7fa1

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
tick-sched: add more debug information
To allow better diagnosis of tick-sched related, especially NOHZ related problems, we need to know when the last wakeup via an irq happened and when the CPU left the idle state. Add two fields (idle_waketime, idle_exittime) to the tick_sched structure and add them to the timer_list output. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 1001d0a commit 5df7fa1

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

include/linux/tick.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ enum tick_nohz_mode {
3939
* @idle_calls: Total number of idle calls
4040
* @idle_sleeps: Number of idle calls, where the sched tick was stopped
4141
* @idle_entrytime: Time when the idle call was entered
42+
* @idle_waketime: Time when the idle was interrupted
43+
* @idle_exittime: Time when the idle state was left
4244
* @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
4345
* @sleep_length: Duration of the current idle sleep
4446
*/
@@ -53,6 +55,8 @@ struct tick_sched {
5355
unsigned long idle_sleeps;
5456
int idle_active;
5557
ktime_t idle_entrytime;
58+
ktime_t idle_waketime;
59+
ktime_t idle_exittime;
5660
ktime_t idle_sleeptime;
5761
ktime_t idle_lastupdate;
5862
ktime_t sleep_length;

kernel/time/tick-sched.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void tick_nohz_update_jiffies(void)
137137

138138
cpu_clear(cpu, nohz_cpu_mask);
139139
now = ktime_get();
140+
ts->idle_waketime = now;
140141

141142
local_irq_save(flags);
142143
tick_do_update_jiffies64(now);
@@ -400,6 +401,7 @@ void tick_nohz_restart_sched_tick(void)
400401
* Cancel the scheduled timer and restore the tick
401402
*/
402403
ts->tick_stopped = 0;
404+
ts->idle_exittime = now;
403405
hrtimer_cancel(&ts->sched_timer);
404406
ts->sched_timer.expires = ts->idle_tick;
405407

kernel/time/timer_list.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
166166
P(idle_calls);
167167
P(idle_sleeps);
168168
P_ns(idle_entrytime);
169+
P_ns(idle_waketime);
170+
P_ns(idle_exittime);
169171
P_ns(idle_sleeptime);
170172
P(last_jiffies);
171173
P(next_jiffies);

0 commit comments

Comments
 (0)