summaryrefslogtreecommitdiffstats
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c8870c5bd7df..c4f7afbe90c0 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -162,6 +162,11 @@ static inline int rt_policy(int policy)
162 return policy == SCHED_FIFO || policy == SCHED_RR; 162 return policy == SCHED_FIFO || policy == SCHED_RR;
163} 163}
164 164
165static inline int litmus_policy(int policy)
166{
167 return policy == SCHED_LITMUS;
168}
169
165static inline int dl_policy(int policy) 170static inline int dl_policy(int policy)
166{ 171{
167 return policy == SCHED_DEADLINE; 172 return policy == SCHED_DEADLINE;
@@ -169,7 +174,8 @@ static inline int dl_policy(int policy)
169static inline bool valid_policy(int policy) 174static inline bool valid_policy(int policy)
170{ 175{
171 return idle_policy(policy) || fair_policy(policy) || 176 return idle_policy(policy) || fair_policy(policy) ||
172 rt_policy(policy) || dl_policy(policy); 177 rt_policy(policy) || dl_policy(policy) ||
178 litmus_policy(policy);
173} 179}
174 180
175static inline int task_has_idle_policy(struct task_struct *p) 181static inline int task_has_idle_policy(struct task_struct *p)
@@ -685,6 +691,10 @@ struct dl_rq {
685 u64 bw_ratio; 691 u64 bw_ratio;
686}; 692};
687 693
694struct litmus_rq {
695 unsigned long nr_running;
696};
697
688#ifdef CONFIG_FAIR_GROUP_SCHED 698#ifdef CONFIG_FAIR_GROUP_SCHED
689/* An entity is a task if it doesn't "own" a runqueue */ 699/* An entity is a task if it doesn't "own" a runqueue */
690#define entity_is_task(se) (!se->my_q) 700#define entity_is_task(se) (!se->my_q)
@@ -881,6 +891,7 @@ struct rq {
881 struct cfs_rq cfs; 891 struct cfs_rq cfs;
882 struct rt_rq rt; 892 struct rt_rq rt;
883 struct dl_rq dl; 893 struct dl_rq dl;
894 struct litmus_rq litmus;
884 895
885#ifdef CONFIG_FAIR_GROUP_SCHED 896#ifdef CONFIG_FAIR_GROUP_SCHED
886 /* list of leaf cfs_rq on this CPU: */ 897 /* list of leaf cfs_rq on this CPU: */
@@ -1783,11 +1794,19 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
1783 next->sched_class->set_next_task(rq, next); 1794 next->sched_class->set_next_task(rq, next);
1784} 1795}
1785 1796
1797/* FIXME: This is conceptually wrong; this should be below the stop-machine
1798 * class, but existing plugins (that predate the stop-machine class) depend on
1799 * the assumption that LITMUS^RT plugins are the top scheduling class.
1800 */
1801#define sched_class_highest (&litmus_sched_class)
1802
1803/*
1786#ifdef CONFIG_SMP 1804#ifdef CONFIG_SMP
1787#define sched_class_highest (&stop_sched_class) 1805#define sched_class_highest (&stop_sched_class)
1788#else 1806#else
1789#define sched_class_highest (&dl_sched_class) 1807#define sched_class_highest (&dl_sched_class)
1790#endif 1808#endif
1809*/
1791 1810
1792#define for_class_range(class, _from, _to) \ 1811#define for_class_range(class, _from, _to) \
1793 for (class = (_from); class != (_to); class = class->next) 1812 for (class = (_from); class != (_to); class = class->next)
@@ -1795,6 +1814,7 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next)
1795#define for_each_class(class) \ 1814#define for_each_class(class) \
1796 for_class_range(class, sched_class_highest, NULL) 1815 for_class_range(class, sched_class_highest, NULL)
1797 1816
1817extern const struct sched_class litmus_sched_class;
1798extern const struct sched_class stop_sched_class; 1818extern const struct sched_class stop_sched_class;
1799extern const struct sched_class dl_sched_class; 1819extern const struct sched_class dl_sched_class;
1800extern const struct sched_class rt_sched_class; 1820extern const struct sched_class rt_sched_class;