History

aio: allocate kiocbs in batches

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.

Jeff Moyer committed 15 years ago

Commit 080d6761 parent 2ca02df2 files · +108 −29Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/aio.h+1−0
@@ -117,6 +117,7 @@ struct kiocb { · 116 unmodified lines
117 117
118 struct list_head ki_list; /* the aio core uses this118 struct list_head ki_list; /* the aio core uses this
119 * for cancellation */119 * for cancellation */
120 struct list_head ki_batch; /* batch allocation */
120 121
121 /*122 /*
122 * If the aio_resfd field of the userspace iocb is not zero,123 * If the aio_resfd field of the userspace iocb is not zero,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t