Messages in this thread | | | From | Peng Tao <> | Date | Wed, 19 Mar 2014 10:17:09 +0800 | Subject | Re: [PATCH RFC] sched: introduce add_wait_queue_exclusive_head |
| |
On Tue, Mar 18, 2014 at 11:47 PM, Oleg Nesterov <oleg@redhat.com> wrote: > On 03/18, Peter Zijlstra wrote: >> >> I think we can avoid the entire function if we add >> WQ_FLAG_LIFO and make prepare_to_wait_event() DTRT. > > Agreed, this looks very natural. > > prepare_to_wait_event(WQ_FLAG_LIFO) should probably skip all "flags == 0" > entries before list_add(). Given that it is supposed that the users won't > mix exclusive and !exclusive, perhaps the additional list_for_each() won't > hurt? > So please allow me to summary and define the semantics of wait/wake_up w.r.t. this.
prepare_to_wait_event(0): task is added at the head of the queue.
prepare_to_wait_event(WQ_FLAG_LIFO): task is added at the head of exclusive queue head
prepare_to_wait_event(WQ_FLAG_EXCLUSIVE): task is added at the tail of the queue
Maybe we should rename the flags to WQ_FLAG_EXCLUSIVE_FIFO and WQ_FLAG_EXCLUSIVE_LIFO?
>> Then we only need to teach ___wait() about this; and I suppose we could >> make .exclusive=-1 be the LIFO flag. > > Or we can change ___wait_event() > > - if (exclusive) \ > - __wait.flags = WQ_FLAG_EXCLUSIVE; \ > - else \ > - __wait.flags = 0; \ > + __wait.flags = exclusive; \ > > and obviously change the callers. Perhaps this argument should be renamed > then. > Current __wait.flags allows possible extension to the existing interface. If we change it to __wait.flags = exclusive, we drop the future extensibility. Is it acceptable?
Thanks, Tao
> But I am fine either way, just I like the idea to extend the current > interface. > > Oleg. >
| |