Re: [PATCH v2 1/2] sched: schedule_tail() should disable preemption

From: Oleg Nesterov
Date: Thu Oct 09 2014 - 11:01:11 EST


On 10/09, Kirill Tkhai wrote:
>
> Ð ÐÑ, 08/10/2014 Ð 21:36 +0200, Oleg Nesterov ÐÐÑÐÑ:
> > @@ -2277,15 +2277,14 @@ static inline void post_schedule(struct rq *rq)
> > asmlinkage __visible void schedule_tail(struct task_struct *prev)
> > __releases(rq->lock)
> > {
> > - struct rq *rq = this_rq();
> > + struct rq *rq;
> >
> > + /* finish_task_switch() drops rq->lock and enables preemtion */
> > + preempt_disable();
>
> Maybe, the code would look simpler if we change
> init_task_preempt_count() and create new tasks
> with preempt_count() == 2, so this preempt_disable()
> won't be necessary. But it's more or less subjectively.

Yes, yes, I thought about the same.

Except I think we should kill init_task_preempt_count() and change
schedule_tail()

- preempt_disable();
+ preempt_count_set(PREEMPT_DISABLED + 1);

but first we need to remove ->saved_preempt_count.

> Reviewed-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>

Thanks!

Oleg.

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