diff options
Diffstat (limited to 'kernel/time/tick-sched.h')
| -rw-r--r-- | kernel/time/tick-sched.h | 74 | 
1 files changed, 74 insertions, 0 deletions
diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h new file mode 100644 index 000000000000..28b5da3e1a17 --- /dev/null +++ b/kernel/time/tick-sched.h  | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | #ifndef _TICK_SCHED_H | ||
| 2 | #define _TICK_SCHED_H | ||
| 3 | |||
| 4 | #include <linux/hrtimer.h> | ||
| 5 | |||
| 6 | enum tick_device_mode { | ||
| 7 | TICKDEV_MODE_PERIODIC, | ||
| 8 | TICKDEV_MODE_ONESHOT, | ||
| 9 | }; | ||
| 10 | |||
| 11 | struct tick_device { | ||
| 12 | struct clock_event_device *evtdev; | ||
| 13 | enum tick_device_mode mode; | ||
| 14 | }; | ||
| 15 | |||
| 16 | enum tick_nohz_mode { | ||
| 17 | NOHZ_MODE_INACTIVE, | ||
| 18 | NOHZ_MODE_LOWRES, | ||
| 19 | NOHZ_MODE_HIGHRES, | ||
| 20 | }; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * struct tick_sched - sched tick emulation and no idle tick control/stats | ||
| 24 | * @sched_timer: hrtimer to schedule the periodic tick in high | ||
| 25 | * resolution mode | ||
| 26 | * @last_tick: Store the last tick expiry time when the tick | ||
| 27 | * timer is modified for nohz sleeps. This is necessary | ||
| 28 | * to resume the tick timer operation in the timeline | ||
| 29 | * when the CPU returns from nohz sleep. | ||
| 30 | * @tick_stopped: Indicator that the idle tick has been stopped | ||
| 31 | * @idle_jiffies: jiffies at the entry to idle for idle time accounting | ||
| 32 | * @idle_calls: Total number of idle calls | ||
| 33 | * @idle_sleeps: Number of idle calls, where the sched tick was stopped | ||
| 34 | * @idle_entrytime: Time when the idle call was entered | ||
| 35 | * @idle_waketime: Time when the idle was interrupted | ||
| 36 | * @idle_exittime: Time when the idle state was left | ||
| 37 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped | ||
| 38 | * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding | ||
| 39 | * @sleep_length: Duration of the current idle sleep | ||
| 40 | * @do_timer_lst: CPU was the last one doing do_timer before going idle | ||
| 41 | */ | ||
| 42 | struct tick_sched { | ||
| 43 | struct hrtimer sched_timer; | ||
| 44 | unsigned long check_clocks; | ||
| 45 | enum tick_nohz_mode nohz_mode; | ||
| 46 | ktime_t last_tick; | ||
| 47 | int inidle; | ||
| 48 | int tick_stopped; | ||
| 49 | unsigned long idle_jiffies; | ||
| 50 | unsigned long idle_calls; | ||
| 51 | unsigned long idle_sleeps; | ||
| 52 | int idle_active; | ||
| 53 | ktime_t idle_entrytime; | ||
| 54 | ktime_t idle_waketime; | ||
| 55 | ktime_t idle_exittime; | ||
| 56 | ktime_t idle_sleeptime; | ||
| 57 | ktime_t iowait_sleeptime; | ||
| 58 | ktime_t sleep_length; | ||
| 59 | unsigned long last_jiffies; | ||
| 60 | unsigned long next_jiffies; | ||
| 61 | ktime_t idle_expires; | ||
| 62 | int do_timer_last; | ||
| 63 | }; | ||
| 64 | |||
| 65 | extern struct tick_sched *tick_get_tick_sched(int cpu); | ||
| 66 | |||
| 67 | extern void tick_setup_sched_timer(void); | ||
| 68 | #if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS | ||
| 69 | extern void tick_cancel_sched_timer(int cpu); | ||
| 70 | #else | ||
| 71 | static inline void tick_cancel_sched_timer(int cpu) { } | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #endif | ||
