mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: suparna@in.ibm.com
Cc: linux-aio@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.6-mm] Avoid flushing AIO workqueue on cancel/exit
Date: Tue, 21 Oct 2003 03:59:00 -0700	[thread overview]
Message-ID: <20031021035900.18040eee.akpm@osdl.org> (raw)
In-Reply-To: <20031021102514.GA4217@in.ibm.com>

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.



  reply	other threads:[~2003-10-21 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-21 10:25 Suparna Bhattacharya
2003-10-21 10:59 ` Andrew Morton [this message]
2003-10-21 11:27   ` Suparna Bhattacharya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031021035900.18040eee.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome