rt.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _SCHED_RT_H
  2. #define _SCHED_RT_H
  3. #include <linux/sched/prio.h>
  4. static inline int rt_prio(int prio)
  5. {
  6. if (unlikely(prio < MAX_RT_PRIO))
  7. return 1;
  8. return 0;
  9. }
  10. static inline int rt_task(struct task_struct *p)
  11. {
  12. return rt_prio(p->prio);
  13. }
  14. #ifdef CONFIG_RT_MUTEXES
  15. extern int rt_mutex_getprio(struct task_struct *p);
  16. extern void rt_mutex_setprio(struct task_struct *p, int prio);
  17. extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio);
  18. extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task);
  19. extern void rt_mutex_adjust_pi(struct task_struct *p);
  20. static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
  21. {
  22. return tsk->pi_blocked_on != NULL;
  23. }
  24. #else
  25. static inline int rt_mutex_getprio(struct task_struct *p)
  26. {
  27. return p->normal_prio;
  28. }
  29. static inline int rt_mutex_get_effective_prio(struct task_struct *task,
  30. int newprio)
  31. {
  32. return newprio;
  33. }
  34. static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
  35. {
  36. return NULL;
  37. }
  38. # define rt_mutex_adjust_pi(p) do { } while (0)
  39. static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
  40. {
  41. return false;
  42. }
  43. #endif
  44. extern void normalize_rt_tasks(void);
  45. /*
  46. * default timeslice is 100 msecs (used only for SCHED_RR tasks).
  47. * Timeslices get refilled after they expire.
  48. */
  49. #define RR_TIMESLICE (100 * HZ / 1000)
  50. #endif /* _SCHED_RT_H */