Introduce new option: iodepth_batch_complete_max
authorRoman Pen <r.peniaev@gmail.com>
Sun, 27 Sep 2015 19:24:55 +0000 (21:24 +0200)
committerJens Axboe <axboe@fb.com>
Thu, 1 Oct 2015 06:54:04 +0000 (08:54 +0200)
commit82407585a3b3b10281428e4ca9c2d3e7dfca7392
treeff9f953b9d186f7303e545006db03e085b7897b7
parente63a0b2f293c6bcf3495c547eba414e1a6cf1840
Introduce new option: iodepth_batch_complete_max

By now there is an option which is called 'iodepth_batch_complete'.
This option provides a possibility to read exact amount of events
of completed IOs, e.g. by default it is set to 1, so only 1 event
will be read on each io_getevents system call:

 7945  io_getevents(139876985688064, 1, 1, {...}NULL) = 1

This option can be set to any desired amount, say the whole iodepth
size can be used, e.g. 128:

 7952  io_getevents(140303500259328, 128, 128, {...}NULL) = 128

We will not exit the system call till the whole queue will be completed.
Sounds not so efficient.

In this patch I add the 'iodepth_batch_complete_max' option and rename
'iodepth_batch_complete' to 'iodepth_batch_complete_min' to have a
possibility to specify a range of events which I want to read.
(of course because of compatibility's sake 'iodepth_batch_complete_min'
 is an alias for 'iodepth_batch_complete').

So finally if options are set to:

 # or iodepth_batch_complete_min=1
 iodepth_batch_complete=1
 # take the iodepth value
 iodepth_batch_complete_max=128

The io_getevents call will look like:

 7961  io_getevents(140173245206528, 1, 128, {...}NULL) = 73

and we will exit the system call with any amount of completed
IOs >= 1.

What are the benefits? Fetching events from the queue can be
done more efficiently on some testing on specific configurations,
e.g. stacked block devices based on null_blk devices, where
completion happens immediately and events should be retried from
the queue ASAP.

Let's take a simple example.

BASE CONFIG:

[global]
fadvise_hint=0
rw=randrw:2
direct=1
size=256M
ioengine=libaio
iodepth=128

time_based=1
runtime=60
ramp_time=10

[job1]
filename=/dev/nullb0

[job2]
filename=/dev/nullb1

[job3]
filename=/dev/nullb2

[job4]
filename=/dev/nullb3

Signed-off-by: Jens Axboe <axboe@fb.com>
HOWTO
backend.c
cconv.c
engines/libaio.c
fio.1
init.c
io_u.c
options.c
thread_options.h