From 40789b06cc0f80e2c8676da7d2273752fcc1983c Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Tue, 28 Jun 2011 10:51:31 +0800 Subject: [PATCH] --- yaml --- r: 257160 b: refs/heads/master c: 1c09ab0d257317f97e8629a3d0c8713d6dd9de4c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/sched_autogroup.h | 1 + trunk/kernel/sched_rt.c | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 3398c6562bcf..f217dc9f428e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 307bf9803f25a8a3f53c1012110fb74e2f893eb0 +refs/heads/master: 1c09ab0d257317f97e8629a3d0c8713d6dd9de4c diff --git a/trunk/kernel/sched_autogroup.h b/trunk/kernel/sched_autogroup.h index 05577055cfca..c2f0e7248dca 100644 --- a/trunk/kernel/sched_autogroup.h +++ b/trunk/kernel/sched_autogroup.h @@ -13,6 +13,7 @@ struct autogroup { int nice; }; +static inline bool task_group_is_autogroup(struct task_group *tg); static inline struct task_group * autogroup_task_group(struct task_struct *p, struct task_group *tg); diff --git a/trunk/kernel/sched_rt.c b/trunk/kernel/sched_rt.c index b03cd89fee20..97540f0c9e47 100644 --- a/trunk/kernel/sched_rt.c +++ b/trunk/kernel/sched_rt.c @@ -185,11 +185,23 @@ static inline u64 sched_rt_period(struct rt_rq *rt_rq) typedef struct task_group *rt_rq_iter_t; -#define for_each_rt_rq(rt_rq, iter, rq) \ - for (iter = list_entry_rcu(task_groups.next, typeof(*iter), list); \ - (&iter->list != &task_groups) && \ - (rt_rq = iter->rt_rq[cpu_of(rq)]); \ - iter = list_entry_rcu(iter->list.next, typeof(*iter), list)) +static inline struct task_group *next_task_group(struct task_group *tg) +{ + do { + tg = list_entry_rcu(tg->list.next, + typeof(struct task_group), list); + } while (&tg->list != &task_groups && task_group_is_autogroup(tg)); + + if (&tg->list == &task_groups) + tg = NULL; + + return tg; +} + +#define for_each_rt_rq(rt_rq, iter, rq) \ + for (iter = container_of(&task_groups, typeof(*iter), list); \ + (iter = next_task_group(iter)) && \ + (rt_rq = iter->rt_rq[cpu_of(rq)]);) static inline void list_add_leaf_rt_rq(struct rt_rq *rt_rq) {