Re: [RFC][PATCH]: wait: don't resched in prepare_to_wait()

From: Peter Zijlstra
Date: Fri Mar 06 2009 - 10:47:25 EST


On Fri, 2009-03-06 at 16:41 +0100, Oleg Nesterov wrote:
> On 03/06, Peter Zijlstra wrote:
> >
> > After prepare to wait, we either call schedule() or find !cond in which
> > case we'll call finish_wait() which contains another preemption check.
> >
> > @@ -73,7 +73,9 @@ prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
> > if (list_empty(&wait->task_list))
> > __add_wait_queue(q, wait);
> > set_current_state(state);
> > + preempt_disable();
> > spin_unlock_irqrestore(&q->lock, flags);
> > + preempt_enable_no_resched();
>
> But this only helps if the task gets TIF_NEED_RESCHED while it was in
> spin_lock_irqsave() section, right? This window should be very small
> unless we have the contention.
>
> Or do you have something else in mind?

No, that was exactly it, we then get preempted only to go to sleep right
afterwards, which would cause a schedule anyway.

So its avoiding a schedule.

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