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