License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-block.git] / include / linux / sched / rt.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
9ccd27cc
IM
2#ifndef _LINUX_SCHED_RT_H
3#define _LINUX_SCHED_RT_H
8bd75c77 4
9ccd27cc
IM
5#include <linux/sched.h>
6
7struct task_struct;
8bd75c77
CW
8
9static inline int rt_prio(int prio)
10{
11 if (unlikely(prio < MAX_RT_PRIO))
12 return 1;
13 return 0;
14}
15
16static inline int rt_task(struct task_struct *p)
17{
18 return rt_prio(p->prio);
19}
20
21#ifdef CONFIG_RT_MUTEXES
acd58620
PZ
22/*
23 * Must hold either p->pi_lock or task_rq(p)->lock.
24 */
25static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
26{
27 return p->pi_top_task;
28}
29extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
8bd75c77
CW
30extern void rt_mutex_adjust_pi(struct task_struct *p);
31static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
32{
33 return tsk->pi_blocked_on != NULL;
34}
35#else
2d3d891d
DF
36static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
37{
38 return NULL;
39}
8bd75c77
CW
40# define rt_mutex_adjust_pi(p) do { } while (0)
41static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
42{
43 return false;
44}
45#endif
46
47extern void normalize_rt_tasks(void);
48
49
bc681593
CW
50/*
51 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
52 * Timeslices get refilled after they expire.
53 */
54#define RR_TIMESLICE (100 * HZ / 1000)
55
9ccd27cc 56#endif /* _LINUX_SCHED_RT_H */