From: Suparna Bhattacharya <suparna@in.ibm.com>
To: akpm@osdl.org
Cc: linux-aio@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] AIO Splice runlist for fairness across io contexts
Date: Thu, 5 Aug 2004 10:11:44 +0530 [thread overview]
Message-ID: <20040805044144.GA4044@in.ibm.com> (raw)
In-Reply-To: <20040805043301.GA3532@in.ibm.com>
On Thu, Aug 05, 2004 at 10:03:01AM +0530, Suparna Bhattacharya wrote:
> [2] aio-splice-runlist.patch
> AIO: Splice runlist to be fairer across multiple io contexts
>
--
Suparna Bhattacharya (suparna@in.ibm.com)
Linux Technology Center
IBM Software Lab, India
---------------------------------------------------
This patch tries be a little fairer across multiple io contexts in handling
retries, helping make sure progress happens uniformly across different io
contexts (especially if they are acting on independent queues).
It splices the ioctx runlist before processing it in __aio_run_iocbs. If
new iocbs get added to the ctx in meantime, it queues a fresh workqueue
entry instead of handling them righaway, so that other ioctxs' retries get
a chance to be processed before the newer entries in the queue.
This might make a difference in a situation where retries are getting
queued very fast on one ioctx, while the workqueue entry for another ioctx
is stuck behind it. I've only seen this occasionally earlier and can't
recreate it consistently, but may be worth including anyway.
linux-2.6.8-rc3-suparna/fs/aio.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff -puN fs/aio.c~aio-splice-runlist fs/aio.c
--- linux-2.6.8-rc3/fs/aio.c~aio-splice-runlist 2004-08-04 14:31:29.000000000 +0530
+++ linux-2.6.8-rc3-suparna/fs/aio.c 2004-08-04 14:31:29.000000000 +0530
@@ -769,13 +769,15 @@ out:
* Assumes it is operating within the aio issuer's mm
* context. Expects to be called with ctx->ctx_lock held
*/
-static void __aio_run_iocbs(struct kioctx *ctx)
+static int __aio_run_iocbs(struct kioctx *ctx)
{
struct kiocb *iocb;
int count = 0;
+ LIST_HEAD(run_list);
- while (!list_empty(&ctx->run_list)) {
- iocb = list_entry(ctx->run_list.next, struct kiocb,
+ list_splice_init(&ctx->run_list, &run_list);
+ while (!list_empty(&run_list)) {
+ iocb = list_entry(run_list.next, struct kiocb,
ki_run_list);
list_del(&iocb->ki_run_list);
/*
@@ -788,6 +790,9 @@ static void __aio_run_iocbs(struct kioct
count++;
}
aio_run++;
+ if (!list_empty(&ctx->run_list))
+ return 1;
+ return 0;
}
/*
@@ -799,9 +804,15 @@ static void __aio_run_iocbs(struct kioct
*/
static inline void aio_run_iocbs(struct kioctx *ctx)
{
+ int requeue;
+
spin_lock_irq(&ctx->ctx_lock);
- __aio_run_iocbs(ctx);
- spin_unlock_irq(&ctx->ctx_lock);
+
+ requeue = __aio_run_iocbs(ctx);
+ spin_unlock_irq(&ctx->ctx_lock);
+ if (requeue)
+ queue_work(aio_wq, &ctx->wq);
+
}
/*
@@ -817,14 +828,17 @@ static void aio_kick_handler(void *data)
{
struct kioctx *ctx = data;
mm_segment_t oldfs = get_fs();
+ int requeue;
set_fs(USER_DS);
use_mm(ctx->mm);
spin_lock_irq(&ctx->ctx_lock);
- __aio_run_iocbs(ctx);
+ requeue =__aio_run_iocbs(ctx);
unuse_mm(ctx->mm);
spin_unlock_irq(&ctx->ctx_lock);
set_fs(oldfs);
+ if (requeue)
+ queue_work(aio_wq, &ctx->wq);
}
_
next prev parent reply other threads:[~2004-08-05 4:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-05 4:33 [PATCH 0/3] Various AIO retry related fixes and enhancements Suparna Bhattacharya
2004-08-05 4:38 ` [PATCH 1/3] Collected AIO retry " Suparna Bhattacharya
2004-08-05 4:41 ` Suparna Bhattacharya [this message]
2004-08-05 4:43 ` [PATCH 3/3] AIO workqueue context switch reduction 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=20040805044144.GA4044@in.ibm.com \
--to=suparna@in.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
/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