diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-07-03 09:30:03 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2009-07-29 17:30:37 -0400 |
| commit | 0a930ce98838ed0a03530fd4960eb3423c9b55bc (patch) | |
| tree | 660e743d49ecbb04a6bd08b577720b86de327f7d /include/linux | |
| parent | 42cd561b099de734b16c92b7e29f418f0d62daad (diff) | |
sched: preempt-rt support
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/hardirq.h | 13 | ||||
| -rw-r--r-- | include/linux/sched.h | 49 |
2 files changed, 49 insertions, 13 deletions
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 1518625411a4..70b12547cfb2 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -96,19 +96,6 @@ | |||
| 96 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) | 96 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) |
| 97 | 97 | ||
| 98 | #ifdef CONFIG_PREEMPT | 98 | #ifdef CONFIG_PREEMPT |
| 99 | # define PREEMPT_CHECK_OFFSET 1 | ||
| 100 | #else | ||
| 101 | # define PREEMPT_CHECK_OFFSET 0 | ||
| 102 | #endif | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Check whether we were atomic before we did preempt_disable(): | ||
| 106 | * (used by the scheduler) | ||
| 107 | */ | ||
| 108 | #define in_atomic_preempt_off() \ | ||
| 109 | ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) | ||
| 110 | |||
| 111 | #ifdef CONFIG_PREEMPT | ||
| 112 | # define preemptible() (preempt_count() == 0 && !irqs_disabled()) | 99 | # define preemptible() (preempt_count() == 0 && !irqs_disabled()) |
| 113 | # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) | 100 | # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) |
| 114 | #else | 101 | #else |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 69faf651b10a..2e5be662deef 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -100,6 +100,17 @@ struct fs_struct; | |||
| 100 | struct bts_context; | 100 | struct bts_context; |
| 101 | struct perf_counter_context; | 101 | struct perf_counter_context; |
| 102 | 102 | ||
| 103 | #ifdef CONFIG_PREEMPT | ||
| 104 | extern int kernel_preemption; | ||
| 105 | #else | ||
| 106 | # define kernel_preemption 0 | ||
| 107 | #endif | ||
| 108 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
| 109 | extern int voluntary_preemption; | ||
| 110 | #else | ||
| 111 | # define voluntary_preemption 0 | ||
| 112 | #endif | ||
| 113 | |||
| 103 | #ifdef CONFIG_PREEMPT_SOFTIRQS | 114 | #ifdef CONFIG_PREEMPT_SOFTIRQS |
| 104 | extern int softirq_preemption; | 115 | extern int softirq_preemption; |
| 105 | #else | 116 | #else |
| @@ -225,6 +236,28 @@ extern struct semaphore kernel_sem; | |||
| 225 | #define set_task_state(tsk, state_value) \ | 236 | #define set_task_state(tsk, state_value) \ |
| 226 | set_mb((tsk)->state, (state_value)) | 237 | set_mb((tsk)->state, (state_value)) |
| 227 | 238 | ||
| 239 | // #define PREEMPT_DIRECT | ||
| 240 | |||
| 241 | #ifdef CONFIG_X86_LOCAL_APIC | ||
| 242 | extern void nmi_show_all_regs(void); | ||
| 243 | #else | ||
| 244 | # define nmi_show_all_regs() do { } while (0) | ||
| 245 | #endif | ||
| 246 | |||
| 247 | #include <linux/smp.h> | ||
| 248 | #include <linux/sem.h> | ||
| 249 | #include <linux/signal.h> | ||
| 250 | #include <linux/securebits.h> | ||
| 251 | #include <linux/fs_struct.h> | ||
| 252 | #include <linux/compiler.h> | ||
| 253 | #include <linux/completion.h> | ||
| 254 | #include <linux/pid.h> | ||
| 255 | #include <linux/percpu.h> | ||
| 256 | #include <linux/topology.h> | ||
| 257 | #include <linux/seccomp.h> | ||
| 258 | |||
| 259 | struct exec_domain; | ||
| 260 | |||
| 228 | /* | 261 | /* |
| 229 | * set_current_state() includes a barrier so that the write of current->state | 262 | * set_current_state() includes a barrier so that the write of current->state |
| 230 | * is correctly serialised wrt the caller's subsequent test of whether to | 263 | * is correctly serialised wrt the caller's subsequent test of whether to |
| @@ -354,6 +387,11 @@ extern signed long schedule_timeout_uninterruptible(signed long timeout); | |||
| 354 | asmlinkage void __schedule(void); | 387 | asmlinkage void __schedule(void); |
| 355 | asmlinkage void schedule(void); | 388 | asmlinkage void schedule(void); |
| 356 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); | 389 | extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); |
| 390 | /* | ||
| 391 | * This one can be called with interrupts disabled, only | ||
| 392 | * to be used by lowlevel arch code! | ||
| 393 | */ | ||
| 394 | asmlinkage void __sched __schedule(void); | ||
| 357 | 395 | ||
| 358 | struct nsproxy; | 396 | struct nsproxy; |
| 359 | struct user_namespace; | 397 | struct user_namespace; |
| @@ -1686,6 +1724,15 @@ extern struct pid *cad_pid; | |||
| 1686 | extern void free_task(struct task_struct *tsk); | 1724 | extern void free_task(struct task_struct *tsk); |
| 1687 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) | 1725 | #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) |
| 1688 | 1726 | ||
| 1727 | #ifdef CONFIG_PREEMPT_RT | ||
| 1728 | extern void __put_task_struct_cb(struct rcu_head *rhp); | ||
| 1729 | |||
| 1730 | static inline void put_task_struct(struct task_struct *t) | ||
| 1731 | { | ||
| 1732 | if (atomic_dec_and_test(&t->usage)) | ||
| 1733 | call_rcu(&t->rcu, __put_task_struct_cb); | ||
| 1734 | } | ||
| 1735 | #else | ||
| 1689 | extern void __put_task_struct(struct task_struct *t); | 1736 | extern void __put_task_struct(struct task_struct *t); |
| 1690 | 1737 | ||
| 1691 | static inline void put_task_struct(struct task_struct *t) | 1738 | static inline void put_task_struct(struct task_struct *t) |
| @@ -1693,6 +1740,7 @@ static inline void put_task_struct(struct task_struct *t) | |||
| 1693 | if (atomic_dec_and_test(&t->usage)) | 1740 | if (atomic_dec_and_test(&t->usage)) |
| 1694 | __put_task_struct(t); | 1741 | __put_task_struct(t); |
| 1695 | } | 1742 | } |
| 1743 | #endif | ||
| 1696 | 1744 | ||
| 1697 | extern cputime_t task_utime(struct task_struct *p); | 1745 | extern cputime_t task_utime(struct task_struct *p); |
| 1698 | extern cputime_t task_stime(struct task_struct *p); | 1746 | extern cputime_t task_stime(struct task_struct *p); |
| @@ -1910,6 +1958,7 @@ extern struct task_struct *curr_task(int cpu); | |||
| 1910 | extern void set_curr_task(int cpu, struct task_struct *p); | 1958 | extern void set_curr_task(int cpu, struct task_struct *p); |
| 1911 | 1959 | ||
| 1912 | void yield(void); | 1960 | void yield(void); |
| 1961 | void __yield(void); | ||
| 1913 | 1962 | ||
| 1914 | /* | 1963 | /* |
| 1915 | * The default (Linux) execution domain. | 1964 | * The default (Linux) execution domain. |
