Re: [patch, v3] aio: allocate kiocbs in batches

From: Daniel Ehrenberg
Date: Thu Sep 22 2011 - 20:33:42 EST


On Thu, Sep 22, 2011 at 9:41 AM, Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:
> Hi,
>
> In testing aio on a fast storage device, I found that the context lock
> takes up a fair amount of cpu time in the I/O submission path.  The
> reason is that we take it for every I/O submitted (see __aio_get_req).
> Since we know how many I/Os are passed to io_submit, we can preallocate
> the kiocbs in batches, reducing the number of times we take and release
> the lock.  In my testing, I was able to reduce the amount of time spent
> in _raw_spin_lock_irq by .56% (average of 3 runs).  The command I used
> to test this was:
>   aio-stress -O -o 2 -o 3 -r 8 -d 128 -b 32 -i 32 -s 16384 <dev>
>
> I also tested the patch with various numbers of events passed to
> io_submit, and I ran the xfstests aio group of tests to ensure I didn't
> break anything.
>

This patch looks great! It produces a significant speedup on a
benchmark I care about.

I have been looking into improving the efficiency of io_submit, and I
believe there is still more work that can be done.

Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/