rt.h 1.4 KB

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