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

From: Yong Zhang
Date: Thu Jan 13 2011 - 00:59:17 EST


On Thu, Jan 13, 2011 at 11:54 AM, Mike Galbraith <efault@xxxxxx> wrote:
> 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. ÂFree unused/unusable rt_se and rt_rq, redirect RT
> tasks to the root task group, and tell __sched_setscheduler() that it's ok.
>
> Signed-off-by: Mike Galbraith <efault@xxxxxx>
> Reported-by: Bharata B Rao <bharata@xxxxxxxxxxxxxxxxxx>

This looks more clear ;)

And a little comment below

>
> ---
> Âkernel/sched.c      |  Â3 ++-
> Âkernel/sched_autogroup.c | Â 27 +++++++++++++++++++++++++++
> Âkernel/sched_autogroup.h | Â Â4 ++++
> Â3 files changed, 33 insertions(+), 1 deletion(-)
> @@ -106,6 +128,11 @@ task_wants_autogroup(struct task_struct
> Â Â Â Âreturn true;
> Â}
>
> +static inline bool task_group_is_autogroup(struct task_group *tg)
> +{
> + Â Â Â return tg != &root_task_group && tg->autogroup;

Isn't just checking tg->autogroup sufficient?

if tg == &root_task_group

> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -4874,7 +4874,8 @@ recheck:
> Â Â Â Â Â Â Â Â * assigned.
> Â Â Â Â Â Â Â Â */
> Â Â Â Â Â Â Â Âif (rt_bandwidth_enabled() && rt_policy(policy) &&
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â task_group(p)->rt_bandwidth.rt_runtime == 0) {
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â task_group(p)->rt_bandwidth.rt_runtime == 0 &&

this check will fail.

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/