Re: Bug in scheduler when using rt_mutex

From: Peter Zijlstra
Date: Wed Jan 19 2011 - 05:38:12 EST


On Wed, 2011-01-19 at 10:44 +0100, Peter Zijlstra wrote:
> +static void
> +switched_from_fair(struct rq *rq, struct task_struct *p, int running)
> +{
> + struct sched_entity *se = &p->se;
> + struct cfs_rq *cfs_rq = cfs_rq_of(se);
> +
> + if (!se->on_rq && p->state != TASK_RUNNING)
> + se->vruntime -= cfs_rq->min_vruntime;
> +}
> +
> /*
> * We switched to the sched_fair class.
> */
> -static void switched_to_fair(struct rq *rq, struct task_struct *p,
> - int running)
> +static void
> +switched_to_fair(struct rq *rq, struct task_struct *p, int running)
> {
> + struct sched_entity *se = &p->se;
> + struct cfs_rq *cfs_rq = cfs_rq_of(se);
> +
> + if (se->on_rq && cfs_rq->curr != se)
> + __dequeue_entity(cfs_rq, se);
> +
> + se->vruntimea += cfs_rq->min_vruntime;
> +
> + if (se->on_rq && cfs_rq->curr != se)
> + __enqueue_entity(cfs_rq, se);
> +
> /*
> * We were most likely switched from sched_rt, so
> * kick off the schedule if running, otherwise just see

Hrm, I think the to bit is not needed with the from thing in place, the
enqueue from _setprio will already have added min_vruntime
--
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/