xref: /openbmc/linux/include/linux/sched/rt.h (revision 1c2dd16a)
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 #ifdef CONFIG_RT_MUTEXES
21 /*
22  * Must hold either p->pi_lock or task_rq(p)->lock.
23  */
24 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
25 {
26 	return p->pi_top_task;
27 }
28 extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
29 extern void rt_mutex_adjust_pi(struct task_struct *p);
30 static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
31 {
32 	return tsk->pi_blocked_on != NULL;
33 }
34 #else
35 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
36 {
37 	return NULL;
38 }
39 # define rt_mutex_adjust_pi(p)		do { } while (0)
40 static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
41 {
42 	return false;
43 }
44 #endif
45 
46 extern void normalize_rt_tasks(void);
47 
48 
49 /*
50  * default timeslice is 100 msecs (used only for SCHED_RR tasks).
51  * Timeslices get refilled after they expire.
52  */
53 #define RR_TIMESLICE		(100 * HZ / 1000)
54 
55 #endif /* _LINUX_SCHED_RT_H */
56