Re: [patch] Re: autogroup: sched_setscheduler() fails

From: Yong Zhang
Date: Wed Jan 12 2011 - 01:33:14 EST


On Wed, Jan 12, 2011 at 1:40 PM, Mike Galbraith <mgalbraith@xxxxxxx> wrote:
> But it'd be better to not touch anything, just deflect RT tasks away
> from useless queues from the start.
>
> sched, autogroup: fix CONFIG_RT_GROUP_SCHED sched_setscheduler() failure.
>
> If CONFIG_RT_GROUP_SCHED is set, sched_setscheduler() fails due to autogroup
> not allocating rt_runtime. ÂSquirrel allocated but useless rt_se and rt_rq
> away for group destruction time, and deflect RT tasks to the root task group.
>
> Signed-off-by: Mike Galbraith <efault@xxxxxx>
> Reported-by: Bharata B Rao <bharata@xxxxxxxxxxxxxxxxxx>
>
> ---
> Âkernel/sched_autogroup.c | Â 13 +++++++++++++
> Âkernel/sched_autogroup.h | Â Â4 ++++
> Â2 files changed, 17 insertions(+)
>
> Index: linux-2.6/kernel/sched_autogroup.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched_autogroup.c
> +++ linux-2.6/kernel/sched_autogroup.c
> @@ -27,6 +27,11 @@ static inline void autogroup_destroy(str
> Â{
> Â Â Â Âstruct autogroup *ag = container_of(kref, struct autogroup, kref);
>
> +#ifdef CONFIG_RT_GROUP_SCHED
> + Â Â Â ag->tg->rt_se = ag->rt_se;
> + Â Â Â ag->tg->rt_rq = ag->rt_rq;
> + Â Â Â ag->tg->rt_bandwidth.rt_runtime = 0;
> +#endif
> Â Â Â Âsched_destroy_group(ag->tg);
> Â}
>
> @@ -72,6 +77,14 @@ static inline struct autogroup *autogrou
> Â Â Â Âinit_rwsem(&ag->lock);
> Â Â Â Âag->id = atomic_inc_return(&autogroup_seq_nr);
> Â Â Â Âag->tg = tg;
> +#ifdef CONFIG_RT_GROUP_SCHED
> + Â Â Â /* Sorry, we don't do RT, go away. */
> + Â Â Â ag->rt_se = tg->rt_se;
> + Â Â Â ag->rt_rq = tg->rt_rq;
> + Â Â Â tg->rt_se = root_task_group.rt_se;
> + Â Â Â tg->rt_rq = root_task_group.rt_rq;
> + Â Â Â tg->rt_bandwidth.rt_runtime = root_task_group.rt_bandwidth.rt_runtime;

Setting rt_runtime both in this patch and the previous one will make tune
other's rt_runtime/rt_period trouble, I guess.

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/