Fix hangs due to iodepth_low
authorRobert Elliott <elliott@hp.com>
Thu, 4 Sep 2014 19:51:05 +0000 (13:51 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 4 Sep 2014 19:51:05 +0000 (13:51 -0600)
With some combinations of iodepth, iodepth_batch, iodepth_batch_complete,
and io_depth_low, do_io hangs after reaping the first set of completions
since io_u_queued_complete is called requesting more completions than
td->cur_depth.

Example printing min_evts and td->cur_depth in the do/while loop:
waiting on min=96 cd=627
waiting on min=96 cd=531
waiting on min=96 cd=435
waiting on min=96 cd=339
waiting on min=96 cd=243
waiting on min=96 cd=147
waiting on min=96 cd=51
Jobs: 12 (f=12): [r(12)] [43.8% done] [0KB/0KB/0KB /s] [0/0/0 iops] [eta 00m:09s]
...
Jobs: 12 (f=12): [r(12)] [0.0% done] [0KB/0KB/0KB /s] [0/0/0 iops] [eta 2863d:18h:28m:38s]
<fio never exits>

Fix this by adjusting min_evts to the current_depth if that is smaller.

Tested with a jobfile including:
iodepth=1011
iodepth_batch=96
iodepth_batch_complete=96
iodepth_low=1
runtime=15
time_based

Modified by Jens to fix the check, and move it into
io_u_queued_complete() instead of at the caller site.

Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index ba192a32a985d88e87378d196404cddd10e93936..be2f242a6e2bce92c7225aff1cf462762c1d3998 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1792,6 +1792,8 @@ int io_u_queued_complete(struct thread_data *td, int min_evts,
 
        if (!min_evts)
                tvp = &ts;
+       else if (min_evts > td->cur_depth)
+               min_evts = td->cur_depth;
 
        ret = td_io_getevents(td, min_evts, td->o.iodepth_batch_complete, tvp);
        if (ret < 0) {