Re: [PATCH] sched: skip autogroup when looking for all rt sched groups

From: Yong Zhang
Date: Mon Jun 27 2011 - 22:47:11 EST


Sorry for my late response and comments below.

On Thu, Jun 23, 2011 at 7:21 PM, Cheng Xu <chengxu@xxxxxxxxxxxxxxxxxx> wrote:
>
> This looks like it works, but seems we might be able to do that with less code...
>
> 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)]);)

Yeah, this works too, and it save some code.

Will update the patch based on it.

Thanks,
Yong



--
Only stand for myself
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/