Adding userspace_libaio_reap option
authorDan Ehrenberg <dehrenberg@google.com>
Wed, 31 Aug 2011 02:36:15 +0000 (20:36 -0600)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 31 Aug 2011 02:36:15 +0000 (20:36 -0600)
commit675012f04dbd821cc5d22ec56930094b9c8a99e5
treec27b93f197d4ccba554f5ad4241896eeb30af023
parent78c1eda5486f586ca73e9cbe7e40b93fccdbd218
Adding userspace_libaio_reap option

When a single thread is reading from a libaio io_context_t object
in a non-blocking polling manner (that is, with the minimum number
of events to return being 0), then it is possible to safely read
events directly from user-space, taking advantage of the fact that
the io_context_t object is a pointer to memory with a certain layout.
This patch adds an option, userspace_libaio_reap, which allows
reading events in this manner when the libaio engine is used.

You can observe its effect by setting iodepth_batch_complete=0
and seeing the change in distribution of system/user time based on
whether this new flag is set. If userspace_libaio_reap=1, then
busy polling takes place in userspace, and there is a larger amount of
usr CPU. If userspace_libaio_reap=0 (the default), then there is a
larger amount of sys CPU from the polling in the kernel.

Polling from a queue in this manner is several times faster. In my
testing, it took less than an eighth as much time to execute a
polling operation in user-space than with the io_getevents syscall.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
HOWTO
engines/libaio.c
fio.h
options.c