diff options
| author | Clark Williams <williams@redhat.com> | 2013-02-07 10:47:07 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-02-07 14:51:08 -0500 |
| commit | 8bd75c77b7c6a3954140dd2e20346aef3efe4a35 (patch) | |
| tree | 10e0d451a58aeb6c8f48b871a848276bf3a8a359 /include/linux/sched | |
| parent | ce0dbbbb30aee6a835511d5be446462388ba9eee (diff) | |
sched/rt: Move rt specific bits into new header file
Move rt scheduler definitions out of include/linux/sched.h into
new file include/linux/sched/rt.h
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20130207094707.7b9f825f@riff.lan
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/sched')
| -rw-r--r-- | include/linux/sched/rt.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h new file mode 100644 index 000000000000..94e19ea28fc3 --- /dev/null +++ b/include/linux/sched/rt.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #ifndef _SCHED_RT_H | ||
| 2 | #define _SCHED_RT_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT | ||
| 6 | * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH | ||
| 7 | * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority | ||
| 8 | * values are inverted: lower p->prio value means higher priority. | ||
| 9 | * | ||
| 10 | * The MAX_USER_RT_PRIO value allows the actual maximum | ||
| 11 | * RT priority to be separate from the value exported to | ||
| 12 | * user-space. This allows kernel threads to set their | ||
| 13 | * priority to a value higher than any user task. Note: | ||
| 14 | * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #define MAX_USER_RT_PRIO 100 | ||
| 18 | #define MAX_RT_PRIO MAX_USER_RT_PRIO | ||
| 19 | |||
| 20 | #define MAX_PRIO (MAX_RT_PRIO + 40) | ||
| 21 | #define DEFAULT_PRIO (MAX_RT_PRIO + 20) | ||
| 22 | |||
| 23 | static inline int rt_prio(int prio) | ||
| 24 | { | ||
| 25 | if (unlikely(prio < MAX_RT_PRIO)) | ||
| 26 | return 1; | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static inline int rt_task(struct task_struct *p) | ||
| 31 | { | ||
| 32 | return rt_prio(p->prio); | ||
| 33 | } | ||
| 34 | |||
| 35 | #ifdef CONFIG_RT_MUTEXES | ||
| 36 | extern int rt_mutex_getprio(struct task_struct *p); | ||
| 37 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | ||
| 38 | extern void rt_mutex_adjust_pi(struct task_struct *p); | ||
| 39 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
| 40 | { | ||
| 41 | return tsk->pi_blocked_on != NULL; | ||
| 42 | } | ||
| 43 | #else | ||
| 44 | static inline int rt_mutex_getprio(struct task_struct *p) | ||
| 45 | { | ||
| 46 | return p->normal_prio; | ||
| 47 | } | ||
| 48 | # define rt_mutex_adjust_pi(p) do { } while (0) | ||
| 49 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
| 50 | { | ||
| 51 | return false; | ||
| 52 | } | ||
| 53 | #endif | ||
| 54 | |||
| 55 | extern void normalize_rt_tasks(void); | ||
| 56 | |||
| 57 | |||
| 58 | #endif /* _SCHED_RT_H */ | ||
