aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorKen Chen <kenneth.w.chen@intel.com>2005-05-01 11:59:16 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:16 -0400
commit954d3e95369cf73b4bc1e570729f68264a0e6fe0 (patch)
tree542c6435428848f02a0eb060a83b3dd1a7f90083 /fs/aio.c
parent644d3a088a3b862ed0b57c286cf58a6bd338ce08 (diff)
[PATCH] aio: optimize io_submit_one()
This patch optimizes io_submit_one to call aio_run_iocb() directly if ctx->run_list is empty. When the list is empty, the operation of adding to the list, then call to __aio_run_iocbs() is unnecessary because these operations are done in one atomic step. ctx->run_list always has only one element in this case. This optimization speeds up industry standard db transaction processing benchmark by 0.2%. Signed-off-by: Ken Chen <kenneth.w.chen@intel.com> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: Suparna Bhattacharya <suparna@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 674bb47fed29..7afa222f6802 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1514,10 +1514,14 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1514 goto out_put_req; 1514 goto out_put_req;
1515 1515
1516 spin_lock_irq(&ctx->ctx_lock); 1516 spin_lock_irq(&ctx->ctx_lock);
1517 list_add_tail(&req->ki_run_list, &ctx->run_list); 1517 if (likely(list_empty(&ctx->run_list))) {
1518 /* drain the run list */ 1518 aio_run_iocb(req);
1519 while (__aio_run_iocbs(ctx)) 1519 } else {
1520 ; 1520 list_add_tail(&req->ki_run_list, &ctx->run_list);
1521 /* drain the run list */
1522 while (__aio_run_iocbs(ctx))
1523 ;
1524 }
1521 spin_unlock_irq(&ctx->ctx_lock); 1525 spin_unlock_irq(&ctx->ctx_lock);
1522 aio_put_req(req); /* drop extra ref to req */ 1526 aio_put_req(req); /* drop extra ref to req */
1523 return 0; 1527 return 0;