Re: [RFC 0/12][PATCH] SCHED_DEADLINE: fork and terminate task logic

From: Peter Zijlstra
Date: Wed Jan 13 2010 - 11:15:50 EST


On Wed, 2010-01-13 at 12:11 +0100, Raistlin wrote:

> > > + } else if (rt_prio(p->prio))
> > > + p->sched_class = &rt_sched_class;
> > > + else
> > > p->sched_class = &fair_sched_class;
> > >
> > > #ifdef CONFIG_SMP
> > > @@ -2744,6 +2756,10 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
> > > if (mm)
> > > mmdrop(mm);
> > > if (unlikely(prev_state == TASK_DEAD)) {
> > > + /* a deadline task is dying: stop the bandwidth timer */
> > > + if (deadline_task(prev))
> > > + hrtimer_cancel(&prev->dl.dl_timer);
> > > +
> > > /*
> > > * Remove function-return probe instances associated with this
> > > * task and put them back on the free list.
> >
> > Shouldn't this be done in the ->dequeue_task() callback?
> >
> Not sure of this snippet... Actually, it is one of the most disturbing
> piece of code of this whole scheduler. :-(
>
> The reason why it is here is that I think it is needed to call
> hrtimer_cancel() _without_ holding the rq->lock, is that correct?

I think we can nest the hrtimer base lock inside the rq->lock these
days, so it should be safe to call while holding it, anyway, lockdep
will quickly tell you if you try ;-)

> It is

Is that a stmt or an unfinished sentence?

--
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/