1 #ifndef _LINUX_SCHED_RT_H 2 #define _LINUX_SCHED_RT_H 3 4 #include <linux/sched.h> 5 6 struct task_struct; 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 static inline bool task_is_realtime(struct task_struct *tsk) 21 { 22 int policy = tsk->policy; 23 24 if (policy == SCHED_FIFO || policy == SCHED_RR) 25 return true; 26 if (policy == SCHED_DEADLINE) 27 return true; 28 return false; 29 } 30 31 #ifdef CONFIG_RT_MUTEXES 32 /* 33 * Must hold either p->pi_lock or task_rq(p)->lock. 34 */ 35 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p) 36 { 37 return p->pi_top_task; 38 } 39 extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task); 40 extern void rt_mutex_adjust_pi(struct task_struct *p); 41 static inline bool tsk_is_pi_blocked(struct task_struct *tsk) 42 { 43 return tsk->pi_blocked_on != NULL; 44 } 45 #else 46 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) 47 { 48 return NULL; 49 } 50 # define rt_mutex_adjust_pi(p) do { } while (0) 51 static inline bool tsk_is_pi_blocked(struct task_struct *tsk) 52 { 53 return false; 54 } 55 #endif 56 57 extern void normalize_rt_tasks(void); 58 59 60 /* 61 * default timeslice is 100 msecs (used only for SCHED_RR tasks). 62 * Timeslices get refilled after they expire. 63 */ 64 #define RR_TIMESLICE (100 * HZ / 1000) 65 66 #endif /* _LINUX_SCHED_RT_H */ 67