lkml.org 
[lkml]   [2003]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][2.6-mm] Avoid flushing AIO workqueue on cancel/exit
Suparna Bhattacharya <suparna@in.ibm.com> wrote:
>
> When streaming AIO requests are in progress on multiple
> io context's, flushing the AIO workqueue on i/o cancellation
> or process exit could potentially end up waiting for a
> long time as fresh requests from other active ioctx's keep
> getting queued up.

But flush_workqueue() will ignore any newly-added work requests:

* This function will sample each workqueue's current insert_sequence number and
* will sleep until the head sequence is greater than or equal to that. This
* means that we sleep until all works which were queued on entry have been
* handled, but we are not livelocked by new incoming ones.

Now, flush_workqueue() is potentially inefficient on SMP because it flushes
each CPU's workqueue sequentially. But we can fix that in
flush_workqueue() by converting it to a two-pass approach:

a) gather each CPU's insert_sequence number into a local array[NR_CPUS]

b) wait until each CPU's remove_sequence number exceeds the previously-gathered
insert_sequence number.


-
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: 2005-03-22 13:58    [from the cache]
©2003-2011 Jasper Spaans