Add extra_buff_count flag
Hi,
I was trying to use the async_verify option. Looks like if we use this option for synchronous I/O, then it really doesnt do anything as after every I/O is completed, we still need the asynchronous verify thread to complete the verification and release the io_u so the main thread can allocate this io_u for the next I/O. So to remove this bottle neck I added a new option extra_buff_count. This takes an integer and the code will allocate that many more extra io_us. This way when the main thread has completed the I/O it will have extra io_u and buffers to issue more I/Os while the asynchronous verify threads do their job. This can be used with both synchronous and libaio contexts. Thanks
-radha
HOWTO +6 -1
@@ -872,7 +872,12 @@ verify_async=int Fio will normally verify IO inline from the submitting verify_async_cpus=str Tell fio to set the given CPU affinity on the async IO verification threads. See cpus_allowed for the format used. - + +extra_buff_count=int Allocate extra I/O buffers to continue issuing + IO to the file/device. This can be used to keep the device + busy with I/Os while the data verification is being + done asynchronously. + stonewall Wait for preceeding jobs in the job file to exit, before starting this one. Can be used to insert serialization points in the job file. A stone wall also implies starting
fio.1 +5 -0
@@ -627,6 +627,11 @@ allows them to have IO in flight while verifies are running. Tell fio to set the given CPU affinity on the async IO verification threads. See \fBcpus_allowed\fP for the format used. .TP +.BI extra_buff_count \fR=\fPint +Allocate extra I/O buffers to continue issuing IO to the file/device. +This can be used to keep the device busy with I/Os while the data verification +is being done asynchronously. +.TP .B stonewall Wait for preceeding jobs in the job file to exit before starting this one. \fBstonewall\fR implies \fBnew_group\fR.
fio.c +5 -3
@@ -534,7 +534,8 @@ sync_done:* if we can queue more, do so. but check if there are * completed io_u's first. */ - full =queue_full (td) || ret ==FIO_Q_BUSY ; + full =queue_full (td) || ret ==FIO_Q_BUSY || + td->cur_depth == td->o.iodepth;if (full || !td->o.iodepth_batch_complete) { min_events = td->o.iodepth_batch_complete;if (full && !min_events)
@@ -686,7 +687,8 @@ sync_done:/* * See if we need to complete some commands */ - full =queue_full (td) || ret ==FIO_Q_BUSY ; + full =queue_full (td) || ret ==FIO_Q_BUSY || + td->cur_depth == td->o.iodepth;if (full || !td->o.iodepth_batch_complete) { min_evts = td->o.iodepth_batch_complete;if (full && !min_evts)
@@ -787,7 +789,7 @@ static int init_io_u(struct thread_data *td)int cl_align, i, max_units;char *p; - max_units = td->o.iodepth; + max_units = td->o.iodepth + td->o.extra_buff_count; max_bs =max (td->o.max_bs[DDIR_READ ], td->o.max_bs[DDIR_WRITE ]); td->orig_buffer_size = (unsigned long long ) max_bs * (unsigned long long ) max_units;
fio.h +1 -0
@@ -181,6 +181,7 @@ struct thread_options {unsigned int verify_pattern_bytes;unsigned int verify_fatal;unsigned int verify_async; +unsigned int extra_buff_count;unsigned int use_thread;unsigned int unlink;unsigned int do_disk_util;
options.c +7 -0
@@ -1337,6 +1337,13 @@ static struct fio_option options[] = { },#endif { + .name = "extra_buff_count", + .type = FIO_OPT_INT, + .off1 = td_var_offset(extra_buff_count), + .def = "0", + .help = "Number of extra buffers to allocate", + }, + { .name = "write_iolog", .type = FIO_OPT_STR_STORE, .off1 = td_var_offset(write_iolog_file),
Quoted 11 lines · Radha Ramachandran
Hi,
I was trying to use theasync_verifyoption. Looks like if we use this option for synchronous I/O, then it really doesnt do anything as after every I/O is completed, we still need the asynchronous verify thread to complete the verification and release theio_uso the main thread can allocate thisio_ufor the next I/O. So to remove this bottle neck I added a new optionextra_buff_count. This takes an integer and the code will allocate that many more extraio_us. This way when the main thread has completed the I/O it will have extraio_uand buffers to issue more I/Os while the asynchronous verify threads do their job. This can be used with both synchronous and libaio contexts.
Does iodepth=x not work for that? If not, I suggest we fix that instead of adding a new parameter for it.
Signature · 1 line
Jens Axboe
Yes, iodepth=x works. I did not realise that I could use iodepth with sync engine as well.
Thanks
-radha
Quoted 24 lines · Jens Axboe
Quoted 11 lines · Radha Ramachandran
Hi,
I was trying to use theasync_verifyoption. Looks like if we use this option for synchronous I/O, then it really doesnt do anything as after every I/O is completed, we still need the asynchronous verify thread to complete the verification and release theio_uso the main thread can allocate thisio_ufor the next I/O. So to remove this bottle neck I added a new optionextra_buff_count. This takes an integer and the code will allocate that many more extraio_us. This way when the main thread has completed the I/O it will have extraio_uand buffers to issue more I/Os while the asynchronous verify threads do their job. This can be used with both synchronous and libaio contexts.Does iodepth=x not work for that? If not, I suggest we fix that instead of adding a new parameter for it.
--
Jens Axboe--
To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Radha Ramachandran
Yes, iodepth=x works. I did not realise that I could use iodepth with sync engine as well.
Good, we should probably default iodepth to verify_async + 1, if a higher number isn't given. And/or document that you probably want to do this.
Signature · 1 line
Jens Axboe
I would rather document it than add it by default in case it starts hitting memory constraints because its allocating more memory buffers.
Also Iam having difficulty running verify_async/libaio engine/iodepth and iodepth_batch_complete options together, I will look into it to see whats causing the issue.
thanks
-radha
Quoted 12 lines · Jens Axboe
Quoted 2 lines · Radha Ramachandran
Yes, iodepth=x works. I did not realise that I could use iodepth with sync engine as well.
Good, we should probably default iodepth to
verify_async+ 1, if a higher number isn't given. And/or document that you probably want to do this.--
Jens Axboe
Quoted 2 lines · Radha Ramachandran
I would rather document it than add it by default in case it starts hitting memory constraints because its allocating more memory buffers.
Yes I agree, I usually don't like having one option implying changes for another either.
Quoted 3 lines
Also Iam having difficulty running verify_async/libaio engine/iodepth and
iodepth_batch_completeoptions together, I will look into it to see whats causing the issue.
OK, I saw some issues on what appears to be races on io_u->flags today, but I haven't investigated that yet.
Signature · 1 line
Jens Axboe
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Radha Ramachandran
I would rather document it than add it by default in case it starts hitting memory constraints because its allocating more memory buffers.
Yes I agree, I usually don't like having one option implying changes for another either.
So the problem with documentation is that usually nobody reads it. This is what the HOWTO/man page currently has:
verify_async=int Fio will normally verify IO inline from the submitting
thread. This option takes an integer describing how many async offload threads to create for IO verification instead, causing fio to offload the duty of verifying IO contents to one or more separate threads. If using this offload option, even sync IO engines can benefit from using an iodepth setting higher than 1, as it allows them to have IO in flight while verifies are running.
It's already documented...
Signature · 1 line
Jens Axboe
Thank you for the documentation update.
You also mentioned that you saw some kind of a race on io_u->flags today, do you by any chance know if you were using iodepth_low or iodepth_batch_complete or libaio engine options.
I think I see an issue when using them and understand why it happens, but dont have a clean fix yet, will hopefully have one soon. I was wondering if its the same issue you are seeing.
Basically the issue is we might think the queue is full (because we cannot allocate any more io_u (they are probably doing async verify)), but the code assumes that if the queue is full, then there is atleast one I/O that we can do "io_getevents" on. And that will cause a hang in the code.
thanks
-radha
Quoted 26 lines · Jens Axboe
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Radha Ramachandran
I would rather document it than add it by default in case it starts hitting memory constraints because its allocating more memory buffers.
Yes I agree, I usually don't like having one option implying changes for another either.
So the problem with documentation is that usually nobody reads it. This is what the HOWTO/man page currently has:
verify_async=int Fio will normally verify IO inline from the submitting thread. This option takes an integer describing how many async offload threads to create for IO verification instead, causing fio to offload the duty of verifying IO contents to one or more separate threads. If using this offload option, even sync IO engines can benefit from using an iodepth setting higher than 1, as it allows them to have IO in flight while verifies are running.
It's already documented...
--
Jens Axboe
Quoted 1 line · Radha Ramachandran
Thank you for the documentation update.
I haven't updated it, it was already there :-)
Quoted 11 lines
You also mentioned that you saw some kind of a race on
io_u->flagstoday, do you by any chance know if you were usingiodepth_loworiodepth_batch_completeor libaio engine options.
I think I see an issue when using them and understand why it happens, but dont have a clean fix yet, will hopefully have one soon. I was wondering if its the same issue you are seeing.
Basically the issue is we might think the queue is full (because we cannot allocate any moreio_u(they are probably doing async verify)), but the code assumes that if the queue is full, then there is atleast one I/O that we can do "io_getevents" on. And that will cause a hang in the code.
I didn't use libaio, I can reproduce it with the sync engine directly and much easier if using fast "null" verifies. It triggers this assert in put_io_u():
assert((io_u->flags & IO_U_F_FREE) == 0);
and this in __get_io_u():
assert(io_u->flags & IO_U_F_FREE);
The former I think is just a bug, it's likely a reput or something, but not sure yet. The latter looks like a race on the flags, since it isn't always locked down when manipulated.
So it sounds like it's two separate issues, I'd urge you to continue debugging yours and I'll fix this one tomorrow.
Signature · 1 line
Jens Axboe
Quoted 18 lines · Jens Axboe
Quoted 11 lines
You also mentioned that you saw some kind of a race on
io_u->flagstoday, do you by any chance know if you were usingiodepth_loworiodepth_batch_completeor libaio engine options.
I think I see an issue when using them and understand why it happens, but dont have a clean fix yet, will hopefully have one soon. I was wondering if its the same issue you are seeing.
Basically the issue is we might think the queue is full (because we cannot allocate any moreio_u(they are probably doing async verify)), but the code assumes that if the queue is full, then there is atleast one I/O that we can do "io_getevents" on. And that will cause a hang in the code.I didn't use libaio, I can reproduce it with the sync engine directly and much easier if using fast "null" verifies. It triggers this assert in
put_io_u():assert((io_u->flags & IO_U_F_FREE) == 0);
Quoted 7 lines
and this in
__get_io_u():assert(io_u->flags & IO_U_F_FREE);The former I think is just a bug, it's likely a reput or something, but not sure yet. The latter looks like a race on the flags, since it isn't always locked down when manipulated.
I think this is fixed now, committed a patch for it.
Signature · 1 line
Jens Axboe
Hi,
This is the patch to fix the race condition when iodepth_batch_complete and verify_async are used. The fix prevents the code from waiting for more I/Os than were actually submitted.
fio.c +4 -2
@@ -536,7 +536,8 @@ sync_done:*/ full =queue_full (td) || ret ==FIO_Q_BUSY ;if (full || !td->o.iodepth_batch_complete) { - min_events = td->o.iodepth_batch_complete; + min_events =min (td->o.iodepth_batch_complete, + td->cur_depth);if (full && !min_events) min_events =1 ;
@@ -688,7 +689,8 @@ sync_done:*/ full =queue_full (td) || ret ==FIO_Q_BUSY ;if (full || !td->o.iodepth_batch_complete) { - min_evts = td->o.iodepth_batch_complete; + min_evts =min (td->o.iodepth_batch_complete, + td->cur_depth);if (full && !min_evts) min_evts =1 ;
thanks
-radha
Quoted 33 lines · Jens Axboe
Quoted 18 lines · Jens Axboe
Quoted 11 lines
You also mentioned that you saw some kind of a race on
io_u->flagstoday, do you by any chance know if you were usingiodepth_loworiodepth_batch_completeor libaio engine options.
I think I see an issue when using them and understand why it happens, but dont have a clean fix yet, will hopefully have one soon. I was wondering if its the same issue you are seeing.
Basically the issue is we might think the queue is full (because we cannot allocate any moreio_u(they are probably doing async verify)), but the code assumes that if the queue is full, then there is atleast one I/O that we can do "io_getevents" on. And that will cause a hang in the code.I didn't use libaio, I can reproduce it with the sync engine directly and much easier if using fast "null" verifies. It triggers this assert in
put_io_u():
assert((io_u->flags & IO_U_F_FREE) == 0);Quoted 7 lines
and this in
__get_io_u():
assert(io_u->flags & IO_U_F_FREE);The former I think is just a bug, it's likely a reput or something, but not sure yet. The latter looks like a race on the flags, since it isn't always locked down when manipulated.
I think this is fixed now, committed a patch for it.
--
Jens Axboe
Quoted 4 lines · Radha Ramachandran
Hi,
This is the patch to fix the race condition wheniodepth_batch_completeandverify_asyncare used. The fix prevents the code from waiting for more I/Os than were actually submitted.
Ah thanks. So it wasn't quite a race, just a bug. I will apply it asap.
Signature · 1 line
Jens Axboe