aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-01-25 15:08:29 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-25 15:08:29 -0500
commit8f4d37ec073c17e2d4aa8851df5837d798606d6f (patch)
treea9ac9063eca53e4d0110e8086f55241ea70ba993 /include
parent02b67cc3ba36bdba351d6c3a00593f4ec550d9d3 (diff)
sched: high-res preemption tick
Use HR-timers (when available) to deliver an accurate preemption tick. The regular scheduler tick that runs at 1/HZ can be too coarse when nice level are used. The fairness system will still keep the cpu utilisation 'fair' by then delaying the task that got an excessive amount of CPU time but try to minimize this by delivering preemption points spot-on. The average frequency of this extra interrupt is sched_latency / nr_latency. Which need not be higher than 1/HZ, its just that the distribution within the sched_latency period is important. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/thread_info_32.h2
-rw-r--r--include/asm-x86/thread_info_64.h5
-rw-r--r--include/linux/hrtimer.h9
-rw-r--r--include/linux/sched.h3
4 files changed, 18 insertions, 1 deletions
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index 22a8cbcd35e2..ef58fd2a6eb0 100644
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -132,6 +132,7 @@ static inline struct thread_info *current_thread_info(void)
132#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ 132#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
133#define TIF_SECCOMP 7 /* secure computing */ 133#define TIF_SECCOMP 7 /* secure computing */
134#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */ 134#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
135#define TIF_HRTICK_RESCHED 9 /* reprogram hrtick timer */
135#define TIF_MEMDIE 16 136#define TIF_MEMDIE 16
136#define TIF_DEBUG 17 /* uses debug registers */ 137#define TIF_DEBUG 17 /* uses debug registers */
137#define TIF_IO_BITMAP 18 /* uses I/O bitmap */ 138#define TIF_IO_BITMAP 18 /* uses I/O bitmap */
@@ -147,6 +148,7 @@ static inline struct thread_info *current_thread_info(void)
147#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 148#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
148#define _TIF_SECCOMP (1<<TIF_SECCOMP) 149#define _TIF_SECCOMP (1<<TIF_SECCOMP)
149#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 150#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
151#define _TIF_HRTICK_RESCHED (1<<TIF_HRTICK_RESCHED)
150#define _TIF_DEBUG (1<<TIF_DEBUG) 152#define _TIF_DEBUG (1<<TIF_DEBUG)
151#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) 153#define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP)
152#define _TIF_FREEZE (1<<TIF_FREEZE) 154#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index beae2bfb62ca..7f6ee68f0002 100644
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -115,6 +115,7 @@ static inline struct thread_info *stack_thread_info(void)
115#define TIF_SECCOMP 8 /* secure computing */ 115#define TIF_SECCOMP 8 /* secure computing */
116#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ 116#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
117#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ 117#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
118#define TIF_HRTICK_RESCHED 11 /* reprogram hrtick timer */
118/* 16 free */ 119/* 16 free */
119#define TIF_IA32 17 /* 32bit process */ 120#define TIF_IA32 17 /* 32bit process */
120#define TIF_FORK 18 /* ret_from_fork */ 121#define TIF_FORK 18 /* ret_from_fork */
@@ -133,6 +134,7 @@ static inline struct thread_info *stack_thread_info(void)
133#define _TIF_SECCOMP (1<<TIF_SECCOMP) 134#define _TIF_SECCOMP (1<<TIF_SECCOMP)
134#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 135#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
135#define _TIF_MCE_NOTIFY (1<<TIF_MCE_NOTIFY) 136#define _TIF_MCE_NOTIFY (1<<TIF_MCE_NOTIFY)
137#define _TIF_HRTICK_RESCHED (1<<TIF_HRTICK_RESCHED)
136#define _TIF_IA32 (1<<TIF_IA32) 138#define _TIF_IA32 (1<<TIF_IA32)
137#define _TIF_FORK (1<<TIF_FORK) 139#define _TIF_FORK (1<<TIF_FORK)
138#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 140#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
@@ -146,6 +148,9 @@ static inline struct thread_info *stack_thread_info(void)
146/* work to do on any return to user space */ 148/* work to do on any return to user space */
147#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 149#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
148 150
151#define _TIF_DO_NOTIFY_MASK \
152 (_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY|_TIF_HRTICK_RESCHED)
153
149/* flags to check in __switch_to() */ 154/* flags to check in __switch_to() */
150#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP) 155#define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP)
151 156
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7a9398e19704..ecc8e2685e2b 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -217,6 +217,11 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
217 return timer->base->get_time(); 217 return timer->base->get_time();
218} 218}
219 219
220static inline int hrtimer_is_hres_active(struct hrtimer *timer)
221{
222 return timer->base->cpu_base->hres_active;
223}
224
220/* 225/*
221 * The resolution of the clocks. The resolution value is returned in 226 * The resolution of the clocks. The resolution value is returned in
222 * the clock_getres() system call to give application programmers an 227 * the clock_getres() system call to give application programmers an
@@ -248,6 +253,10 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
248 return timer->base->softirq_time; 253 return timer->base->softirq_time;
249} 254}
250 255
256static inline int hrtimer_is_hres_active(struct hrtimer *timer)
257{
258 return 0;
259}
251#endif 260#endif
252 261
253extern ktime_t ktime_get(void); 262extern ktime_t ktime_get(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7907845c2348..43e0339d65fc 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -257,6 +257,7 @@ extern void trap_init(void);
257extern void account_process_tick(struct task_struct *task, int user); 257extern void account_process_tick(struct task_struct *task, int user);
258extern void update_process_times(int user); 258extern void update_process_times(int user);
259extern void scheduler_tick(void); 259extern void scheduler_tick(void);
260extern void hrtick_resched(void);
260 261
261extern void sched_show_task(struct task_struct *p); 262extern void sched_show_task(struct task_struct *p);
262 263
@@ -849,7 +850,7 @@ struct sched_class {
849#endif 850#endif
850 851
851 void (*set_curr_task) (struct rq *rq); 852 void (*set_curr_task) (struct rq *rq);
852 void (*task_tick) (struct rq *rq, struct task_struct *p); 853 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
853 void (*task_new) (struct rq *rq, struct task_struct *p); 854 void (*task_new) (struct rq *rq, struct task_struct *p);
854 void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask); 855 void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask);
855 856