lkml.org 
[lkml]   [2007]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: [patch] aio: add per task aio wait event condition
    Date
    Zach Brown wrote on Tuesday, January 02, 2007 5:24 PM
    > > That is not possible because when multiple tasks waiting for
    > > events, they
    > > enter the wait queue in FIFO order, prepare_to_wait_exclusive() does
    > > __add_wait_queue_tail(). So first io_getevents() with min_nr of 2
    > > will be woken up when 2 ops completes.
    >
    > So switch the order of the two sleepers in the example?

    Not sure why that would be a problem though: whoever sleep first will
    be woken up first.


    > The point is that there's no way to guarantee that the head of the
    > wait queue will be the lowest min_nr.

    Before I challenge that semantics, I want to mention that in current
    implementation, dribbling AIO events will be distributed in round robin
    fashion to all pending tasks waiting in io_getevents. In the example you
    gave earlier, task with min_nr of 2 will be woken up after 4 completed
    events. I consider that as an undesirable behavior as well.

    Going back to your counter argument, why do we need the lowest min_nr in
    the head of the queue? These are tasks that shares one aio ctx and ioctx
    is shareable only among threads. Any reason why round robin policy is
    superior than FIFO? Also presumably, threads that shares ioctx should be
    capable of handling events for the same ioctx.

    From wakeup order point of view, yes, tasks with lowest min_nr wakes up
    first, but looking from io completion order, they are not. And these are
    the source of excessive ctx switch.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-01-03 02:53    [W:4.469 / U:1.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site