Ingo Molnar | 9ccd27c | 2017-02-03 21:11:09 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_SCHED_RT_H |
| 2 | #define _LINUX_SCHED_RT_H |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 3 | |
Ingo Molnar | 9ccd27c | 2017-02-03 21:11:09 +0100 | [diff] [blame] | 4 | #include <linux/sched.h> |
| 5 | |
| 6 | struct task_struct; |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 7 | |
| 8 | static inline int rt_prio(int prio) |
| 9 | { |
| 10 | if (unlikely(prio < MAX_RT_PRIO)) |
| 11 | return 1; |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | static inline int rt_task(struct task_struct *p) |
| 16 | { |
| 17 | return rt_prio(p->prio); |
| 18 | } |
| 19 | |
| 20 | #ifdef CONFIG_RT_MUTEXES |
| 21 | extern int rt_mutex_getprio(struct task_struct *p); |
| 22 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
Thomas Gleixner | 0782e63 | 2015-05-05 19:49:49 +0200 | [diff] [blame] | 23 | extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio); |
Dario Faggioli | 2d3d891 | 2013-11-07 14:43:44 +0100 | [diff] [blame] | 24 | extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 25 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
| 26 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) |
| 27 | { |
| 28 | return tsk->pi_blocked_on != NULL; |
| 29 | } |
| 30 | #else |
| 31 | static inline int rt_mutex_getprio(struct task_struct *p) |
| 32 | { |
| 33 | return p->normal_prio; |
| 34 | } |
Thomas Gleixner | c365c29 | 2014-02-07 20:58:42 +0100 | [diff] [blame] | 35 | |
Thomas Gleixner | 0782e63 | 2015-05-05 19:49:49 +0200 | [diff] [blame] | 36 | static inline int rt_mutex_get_effective_prio(struct task_struct *task, |
| 37 | int newprio) |
Thomas Gleixner | c365c29 | 2014-02-07 20:58:42 +0100 | [diff] [blame] | 38 | { |
Thomas Gleixner | 0782e63 | 2015-05-05 19:49:49 +0200 | [diff] [blame] | 39 | return newprio; |
Thomas Gleixner | c365c29 | 2014-02-07 20:58:42 +0100 | [diff] [blame] | 40 | } |
| 41 | |
Dario Faggioli | 2d3d891 | 2013-11-07 14:43:44 +0100 | [diff] [blame] | 42 | static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) |
| 43 | { |
| 44 | return NULL; |
| 45 | } |
Clark Williams | 8bd75c7 | 2013-02-07 09:47:07 -0600 | [diff] [blame] | 46 | # define rt_mutex_adjust_pi(p) do { } while (0) |
| 47 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) |
| 48 | { |
| 49 | return false; |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | extern void normalize_rt_tasks(void); |
| 54 | |
| 55 | |
Clark Williams | bc68159 | 2013-02-22 09:20:11 -0800 | [diff] [blame] | 56 | /* |
| 57 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). |
| 58 | * Timeslices get refilled after they expire. |
| 59 | */ |
| 60 | #define RR_TIMESLICE (100 * HZ / 1000) |
| 61 | |
Ingo Molnar | 9ccd27c | 2017-02-03 21:11:09 +0100 | [diff] [blame] | 62 | #endif /* _LINUX_SCHED_RT_H */ |