Re: Bug in scheduler when using rt_mutex

From: Yong Zhang
Date: Wed Jan 19 2011 - 23:27:15 EST


on Thu, Jan 20, 2011 at 12:18 PM, Yong Zhang <yong.zhang0@xxxxxxxxx> wrote:
> On Wed, Jan 19, 2011 at 9:30 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>> +static void switched_from_fair(struct rq *rq, struct task_struct *p)
>> +{
>> + Â Â Â struct sched_entity *se = &p->se;
>> + Â Â Â struct cfs_rq *cfs_rq = cfs_rq_of(se);
>> +
>> + Â Â Â /*
>> + Â Â Â Â* Ensure the task's vruntime is normalized, so that when its
>> + Â Â Â Â* switched back to the fair class the enqueue_entity(.flags=0) will
>> + Â Â Â Â* do the right thing.
>> + Â Â Â Â*
>> + Â Â Â Â* If it was on_rq, then the dequeue_entity(.flags=0) will already
>> + Â Â Â Â* have normalized the vruntime, if it was !on_rq, then only when
>> + Â Â Â Â* the task is sleeping will it still have non-normalized vruntime.
>> + Â Â Â Â*/
>> + Â Â Â if (!se->on_rq && p->state != TASK_RUNNING)
>> + Â Â Â Â Â Â Â se->vruntime -= cfs_rq->min_vruntime;
>
> Here it's possible that se->vruntime is little than cfs_rq->min_vruntime.

Maybe we can:
place_entity(cfs_rq, se, 0);
se->vruntime -= cfs_rq->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/