diff options
-rw-r--r-- | kernel/sched_autogroup.h | 1 | ||||
-rw-r--r-- | kernel/sched_rt.c | 22 |
2 files changed, 18 insertions, 5 deletions
diff --git a/kernel/sched_autogroup.h b/kernel/sched_autogroup.h index 05577055cfca..c2f0e7248dca 100644 --- a/kernel/sched_autogroup.h +++ b/kernel/sched_autogroup.h | |||
@@ -13,6 +13,7 @@ struct autogroup { | |||
13 | int nice; | 13 | int nice; |
14 | }; | 14 | }; |
15 | 15 | ||
16 | static inline bool task_group_is_autogroup(struct task_group *tg); | ||
16 | static inline struct task_group * | 17 | static inline struct task_group * |
17 | autogroup_task_group(struct task_struct *p, struct task_group *tg); | 18 | autogroup_task_group(struct task_struct *p, struct task_group *tg); |
18 | 19 | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index b03cd89fee20..97540f0c9e47 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -185,11 +185,23 @@ static inline u64 sched_rt_period(struct rt_rq *rt_rq) | |||
185 | 185 | ||
186 | typedef struct task_group *rt_rq_iter_t; | 186 | typedef struct task_group *rt_rq_iter_t; |
187 | 187 | ||
188 | #define for_each_rt_rq(rt_rq, iter, rq) \ | 188 | static inline struct task_group *next_task_group(struct task_group *tg) |
189 | for (iter = list_entry_rcu(task_groups.next, typeof(*iter), list); \ | 189 | { |
190 | (&iter->list != &task_groups) && \ | 190 | do { |
191 | (rt_rq = iter->rt_rq[cpu_of(rq)]); \ | 191 | tg = list_entry_rcu(tg->list.next, |
192 | iter = list_entry_rcu(iter->list.next, typeof(*iter), list)) | 192 | typeof(struct task_group), list); |
193 | } while (&tg->list != &task_groups && task_group_is_autogroup(tg)); | ||
194 | |||
195 | if (&tg->list == &task_groups) | ||
196 | tg = NULL; | ||
197 | |||
198 | return tg; | ||
199 | } | ||
200 | |||
201 | #define for_each_rt_rq(rt_rq, iter, rq) \ | ||
202 | for (iter = container_of(&task_groups, typeof(*iter), list); \ | ||
203 | (iter = next_task_group(iter)) && \ | ||
204 | (rt_rq = iter->rt_rq[cpu_of(rq)]);) | ||
193 | 205 | ||
194 | static inline void list_add_leaf_rt_rq(struct rt_rq *rt_rq) | 206 | static inline void list_add_leaf_rt_rq(struct rt_rq *rt_rq) |
195 | { | 207 | { |