pvsync2: Make hipri option probabilistic
PATCH 1/1 pvsync2: Make hipri option probabilistic
From: Stephen Bates <[email protected]>
Allow the user to set the probability of a pvsync2 IO being high priority. This allows the user to investigate performance when there is a mix of higher and lower priority IO.
--- HOWTO | 3 ++- engines/sync.c | 20 +++++++++++++++++--- fio.1 | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-)
HOWTO +2 -1
@@ -1817,7 +1817,8 @@ caveat that when used on the command line, they must come after the .. option:: hipri : [pvsync2] Set RWF_HIPRI on I/O, indicating to the kernel that it's of higher priority - than normal. + than normal. This is a value is in the range [0, 100] and it + is probabilitistically applied to each IO. .. option:: cpuload=int : [cpuio]
engines/sync.c +17 -3
@@ -14,6 +14,9 @@#include "../fio.h" #include "../optgroup.h" +#ifdef FIO_HAVE_PWRITEV2 +#include "../lib/rand.h" +#endif /* * Sync engine uses engine_data to store last offset
@@ -30,6 +33,11 @@ struct syncio_data {unsigned long long last_offset;struct fio_file *last_file;enum fio_ddir last_ddir; + +#ifdef FIO_HAVE_PWRITEV2 +struct frand_state rand_state; +#endif + };#ifdef FIO_HAVE_PWRITEV2
@@ -42,9 +50,11 @@ static struct fio_option options[] = { { .name = "hipri", .lname = "RWF_HIPRI", - .type = FIO_OPT_STR_SET, + .type = FIO_OPT_INT, .off1 = offsetof(struct psyncv2_options, hipri), - .help = "Set RWF_HIPRI for pwritev2/preadv2", + .minval = 0, + .maxval = 100, + .help = "Probabilistically set RWF_HIPRI for pwritev2/preadv2", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
@@ -132,7 +142,7 @@ static int fio_pvsyncio2_queue(struct thread_data *td, struct io_u *io_u)fio_ro_check (td, io_u); -if (o->hipri) +if ((o->hipri ==100 ) || (rand32_between (&sd->rand_state,0 ,100 ) < o->hipri)) flags |=RWF_HIPRI ; iov->iov_base = io_u->xfer_buf;
@@ -364,6 +374,10 @@ static int fio_vsyncio_init(struct thread_data *td) sd->iovecs =malloc (td->o.iodepth *sizeof (struct iovec )); sd->io_us =malloc (td->o.iodepth *sizeof (struct io_u *)); +#ifdef FIO_HAVE_PWRITEV2 +init_rand (&sd->rand_state,0 ); +#endif + td->io_ops_data = sd;return 0 ; }
fio.1 +2 -1
@@ -2015,7 +2015,8 @@ iodepth_batch_complete=0). .TP .BI (pvsync2)hipri Set RWF_HIPRI on IO, indicating to the kernel that it's of -higher priority than normal. +higher priority than normal. This is a value is in the range +[0, 100] and it is probabilitistically applied to each IO. .TP .BI (net,netsplice)hostname \fR=\fPstr The host name or IP address to use for TCP or UDP based IO.
Signature · 1 line
1.9.1
Quoted 5 lines · On 07/26/2017 05:05 PM, [email protected] wrote:
From: Stephen Bates <[email protected]>
Allow the user to set the probability of a pvsync2 IO being high priority. This allows the user to investigate performance when there is a mix of higher and lower priority IO.
You are potentially breaking existing scripts with this change. If someone currently has:
hipri=1
in their job file, it'll work fine. After this change, it'll be 1% polled IO.
Signature · 1 line
Jens Axboe
Quoted 8 lines
You are potentially breaking existing scripts with this change. If someone currently has:
hipri=1
in their job file, it'll work fine. After this change, it'll be 1% polled IO.
Fair point. How about I make it a float and use values between 0 and 1? That way existing scripts will continue to work.
Stephen
Quoted 11 lines · Stephen Bates
Quoted 8 lines
You are potentially breaking existing scripts with this change. If someone currently has:
hipri=1
in their job file, it'll work fine. After this change, it'll be 1% polled IO.
Fair point. How about I make it a float and use values between 0 and 1? That way existing scripts will continue to work.
That's kind of horrible from a usability point of view. Other percentage options take 0..100. Since it's just an IO engine option, just add a hipri_percentage or something option instead, which takes 0..100 as the input.
Signature · 1 line
Jens Axboe
Hi,
Quoted 5 lines · On 27 July 2017 at 00:05, <[email protected]> wrote:
From: Stephen Bates <[email protected]>
Allow the user to set the probability of a pvsync2 IO being high priority. This allows the user to investigate performance when there is a mix of higher and lower priority IO.
I'll just note this seems to be a feature that people are reluctant to send upstream. I'm aware of at least one fio fork
(https://github.com/Seagate/fio/commits/master ) that adds this feature and it's been asked about on the mailing list
(https://www.spinics.net/lists/fio/msg05487.html ) so even if it takes a few rounds of polishing for you to get it in I wish you the best of luck!
Signature · 1 line
Sitsofe | http://sucs.org/~sits/
Quoted 9 lines · Sitsofe Wheeler
Hi,
Quoted 5 lines · On 27 July 2017 at 00:05, <[email protected]> wrote:
From: Stephen Bates <[email protected]>
Allow the user to set the probability of a pvsync2 IO being high priority. This allows the user to investigate performance when there is a mix of higher and lower priority IO.
Quoted 7 lines
I'll just note this seems to be a feature that people are reluctant to send upstream. I'm aware of at least one fio fork
(https://github.com/Seagate/fio/commits/master ) that adds this feature and it's been asked about on the mailing list
(https://www.spinics.net/lists/fio/msg05487.html ) so even if it takes a few rounds of polishing for you to get it in I wish you the best of luck!
Those are different, that's for passing in NCQ priority info. The pvsync2 hipri option sets RWF_HIPRI, which translates into polled IO for direct=1 in the kernel. That goes for both the github repo and the email on the list. It's pointless to add this to fio, before a kernel API exists for passing in priority information. RWF_HIPRI means polling now.
Not that this is the right list, but I would suggest that someone wanting to pursue this on the kernel side would add it through the new fcntl F_SET_RW_HINT or F_SET_FILE_RW_HINT interface that was added in 4.13:
Once that is done, then support can be added to fio.
Signature · 1 line
Jens Axboe