Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_SCHED_RT_H
0003 #define _LINUX_SCHED_RT_H
0004 
0005 #include <linux/sched.h>
0006 
0007 struct task_struct;
0008 
0009 static inline int rt_prio(int prio)
0010 {
0011     if (unlikely(prio < MAX_RT_PRIO))
0012         return 1;
0013     return 0;
0014 }
0015 
0016 static inline int rt_task(struct task_struct *p)
0017 {
0018     return rt_prio(p->prio);
0019 }
0020 
0021 static inline bool task_is_realtime(struct task_struct *tsk)
0022 {
0023     int policy = tsk->policy;
0024 
0025     if (policy == SCHED_FIFO || policy == SCHED_RR)
0026         return true;
0027     if (policy == SCHED_DEADLINE)
0028         return true;
0029     return false;
0030 }
0031 
0032 #ifdef CONFIG_RT_MUTEXES
0033 /*
0034  * Must hold either p->pi_lock or task_rq(p)->lock.
0035  */
0036 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
0037 {
0038     return p->pi_top_task;
0039 }
0040 extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
0041 extern void rt_mutex_adjust_pi(struct task_struct *p);
0042 #else
0043 static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
0044 {
0045     return NULL;
0046 }
0047 # define rt_mutex_adjust_pi(p)      do { } while (0)
0048 #endif
0049 
0050 extern void normalize_rt_tasks(void);
0051 
0052 
0053 /*
0054  * default timeslice is 100 msecs (used only for SCHED_RR tasks).
0055  * Timeslices get refilled after they expire.
0056  */
0057 #define RR_TIMESLICE        (100 * HZ / 1000)
0058 
0059 #endif /* _LINUX_SCHED_RT_H */