Messages in this thread | | | From | "Chen, Kenneth W" <> | Subject | RE: [patch] aio: add per task aio wait event condition | Date | Tue, 2 Jan 2007 17:16:55 -0800 |
| |
Zach Brown wrote on Tuesday, January 02, 2007 4:49 PM > On Dec 29, 2006, at 6:31 PM, Chen, Kenneth W wrote: > > This patch adds a wait condition to the wait queue and only wake-up > > process when that condition meets. And this condition is added on a > > per task base for handling multi-threaded app that shares single > > ioctx. > > But only one of the waiting tasks is tested, the one at the head of > the list. It looks like this change could starve a io_getevents() > with a low min_nr in the presence of another io_getevents() with a > larger min_nr. > > > + if (waitqueue_active(&ctx->wait)) { > > + struct aio_wait_queue *wait; > > + wait = container_of(ctx->wait.task_list.next, > > + struct aio_wait_queue, wait.task_list); > > + if (nr_evt >= wait->nr_wait) > > + wake_up(&ctx->wait); > > + } > > First is the fear of starvation as mentioned previously. > > issue 2 ops > first io_getevents sleeps with a min_nr of 2 > second io_getevents sleeps with min_nr of 3 > 2 ops complete but only test the second sleeper's min_nr of 3 > first sleeper twiddles thumbs
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.
- 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/
| |