Re: [PATCH RFC] sched: introduce add_wait_queue_exclusive_head

From: Peter Zijlstra
Date: Tue Mar 18 2014 - 10:05:22 EST


On Tue, Mar 18, 2014 at 09:51:04PM +0800, Peng Tao wrote:
> > Firstly I think the _head postfix for LIFO is a bad name,
> Do you have any preference on the name? add_wait_queue_exclusive_lifo()?

I think we can avoid the entire function if we add
WQ_FLAG_LIFO and make prepare_to_wait_event() DTRT.

Then we only need to teach ___wait() about this; and I suppose we could
make .exclusive=-1 be the LIFO flag.

Unless you cannot use ___wait() and really need to open-code the
wait_event() stuff.

> > If you don't mix exclusive and !exclusive tasks on the same waitqueue
> > this isn't a problem, but I'm sure people will eventually do this and
> > get a nasty surprise.
> >
> Yes, Lustre takes care not to mix exclusive and !exclusive tasks in this case.

Right; I saw you had a comment to that effect after I wrote this email.

> > I'm not sure what the best way around this would be; but I can see two
> > options:
> >
> > - add enough debugging bits to detect this fail case.
> > - extend wait_queue_head_t to keep a pointer to the first !exclusive

s/!//

> > element and insert exclusive LIFO tasks there -- thereby keeping
> > !exclusive tasks at the front.
> >
> Thank you for the suggestions. Personally I am in favor of the second
> one but I'll wait others to comment first.

Oleg, Ingo, any preferences?
--
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/