to be effective, NCQ priority must be supported and enabled, and `direct=1'
option must be used. fio must also be run as the root user.
+.. option:: cmdprio_class=int[,int] : [io_uring] [libaio]
+
+ Set the I/O priority class to use for I/Os that must be issued with
+ a priority when :option:`cmdprio_percentage` is set. If not specified
+ when :option:`cmdprio_percentage` is set, this defaults to the highest
+ priority class. A single value applies to reads and writes.
+ Comma-separated values may be specified for reads and writes. See
+ :manpage:`ionice(1)`. See also the :option:`prioclass` option.
+
+.. option:: cmdprio=int[,int] : [io_uring] [libaio]
+
+ Set the I/O priority value to use for I/Os that must be issued with
+ a priority when :option:`cmdprio_percentage` is set. If not specified
+ when :option:`cmdprio_percentage` is set, this defaults to 0.
+ Linux limits us to a positive value between 0 and 7, with 0 being the
+ highest. A single value applies to reads and writes. Comma-separated
+ values may be specified for reads and writes. See :manpage:`ionice(1)`.
+ Refer to an appropriate manpage for other operating systems since
+ meaning of priority may differ. See also the :option:`prio` option.
+
.. option:: fixedbufs : [io_uring]
If fio is asked to do direct IO, then Linux will map pages for each
between 0 and 7, with 0 being the highest. See man
:manpage:`ionice(1)`. Refer to an appropriate manpage for other operating
systems since meaning of priority may differ. For per-command priority
- setting, see I/O engine specific `cmdprio_percentage` option.
+ setting, see I/O engine specific :option:`cmdprio_percentage` and
+ :option:`cmdprio` options.
.. option:: prioclass=int
Set the I/O priority class. See man :manpage:`ionice(1)`. For per-command
- priority setting, see I/O engine specific `cmdprio_percentage` option.
+ priority setting, see I/O engine specific :option:`cmdprio_percentage`
+ and :option:`cmdprio_class` options.
.. option:: cpus_allowed=str
struct cmdprio {
unsigned int percentage[DDIR_RWDIR_CNT];
+ unsigned int class[DDIR_RWDIR_CNT];
+ unsigned int level[DDIR_RWDIR_CNT];
};
static int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio,
bool has_cmdprio_percentage = false;
int i;
+ /*
+ * If cmdprio_percentage is set and cmdprio_class is not set,
+ * default to RT priority class.
+ */
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
- if (cmdprio->percentage[i])
+ if (cmdprio->percentage[i]) {
+ if (!cmdprio->class[i])
+ cmdprio->class[i] = IOPRIO_CLASS_RT;
has_cmdprio_percentage = true;
+ }
}
/*
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_IOURING,
},
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct ioring_options,
+ cmdprio.class[DDIR_READ]),
+ .off2 = offsetof(struct ioring_options,
+ cmdprio.class[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority class",
+ .minval = IOPRIO_MIN_PRIO_CLASS + 1,
+ .maxval = IOPRIO_MAX_PRIO_CLASS,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_IOURING,
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct ioring_options,
+ cmdprio.level[DDIR_READ]),
+ .off2 = offsetof(struct ioring_options,
+ cmdprio.level[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority level",
+ .minval = IOPRIO_MIN_PRIO,
+ .maxval = IOPRIO_MAX_PRIO,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_IOURING,
+ },
#else
{
.name = "cmdprio_percentage",
.type = FIO_OPT_UNSUPPORTED,
.help = "Your platform does not support I/O priority classes",
},
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
#endif
{
.name = "fixedbufs",
struct ioring_data *ld = td->io_ops_data;
struct io_uring_sqe *sqe = &ld->sqes[io_u->index];
struct cmdprio *cmdprio = &o->cmdprio;
- unsigned int p = cmdprio->percentage[io_u->ddir];
+ enum fio_ddir ddir = io_u->ddir;
+ unsigned int p = cmdprio->percentage[ddir];
if (p && rand_between(&td->prio_state, 0, 99) < p) {
- sqe->ioprio = ioprio_value(IOPRIO_CLASS_RT, 0);
+ sqe->ioprio =
+ ioprio_value(cmdprio->class[ddir], cmdprio->level[ddir]);
io_u->flags |= IO_U_F_PRIORITY;
} else {
sqe->ioprio = 0;
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_LIBAIO,
},
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio.class[DDIR_READ]),
+ .off2 = offsetof(struct libaio_options,
+ cmdprio.class[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority class",
+ .minval = IOPRIO_MIN_PRIO_CLASS + 1,
+ .maxval = IOPRIO_MAX_PRIO_CLASS,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct libaio_options,
+ cmdprio.level[DDIR_READ]),
+ .off2 = offsetof(struct libaio_options,
+ cmdprio.level[DDIR_WRITE]),
+ .help = "Set asynchronous IO priority level",
+ .minval = IOPRIO_MIN_PRIO,
+ .maxval = IOPRIO_MAX_PRIO,
+ .interval = 1,
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_LIBAIO,
+ },
#else
{
.name = "cmdprio_percentage",
.type = FIO_OPT_UNSUPPORTED,
.help = "Your platform does not support I/O priority classes",
},
+ {
+ .name = "cmdprio_class",
+ .lname = "Asynchronous I/O priority class",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
+ {
+ .name = "cmdprio",
+ .lname = "Asynchronous I/O priority level",
+ .type = FIO_OPT_UNSUPPORTED,
+ .help = "Your platform does not support I/O priority classes",
+ },
#endif
{
.name = "nowait",
{
struct libaio_options *o = td->eo;
struct cmdprio *cmdprio = &o->cmdprio;
- unsigned int p = cmdprio->percentage[io_u->ddir];
+ enum fio_ddir ddir = io_u->ddir;
+ unsigned int p = cmdprio->percentage[ddir];
if (p && rand_between(&td->prio_state, 0, 99) < p) {
- io_u->iocb.aio_reqprio = ioprio_value(IOPRIO_CLASS_RT, 0);
+ io_u->iocb.aio_reqprio =
+ ioprio_value(cmdprio->class[ddir], cmdprio->level[ddir]);
io_u->iocb.u.c.flags |= IOCB_FLAG_IOPRIO;
io_u->flags |= IO_U_F_PRIORITY;
}
NCQ priority must be supported and enabled, and `direct=1' option must be
used. fio must also be run as the root user.
.TP
+.BI (io_uring,libaio)cmdprio_class \fR=\fPint[,int]
+Set the I/O priority class to use for I/Os that must be issued with a
+priority when \fBcmdprio_percentage\fR is set. If not specified when
+\fBcmdprio_percentage\fR is set, this defaults to the highest priority
+class. A single value applies to reads and writes. Comma-separated
+values may be specified for reads and writes. See man \fBionice\fR\|(1).
+See also the \fBprioclass\fR option.
+.TP
+.BI (io_uring,libaio)cmdprio \fR=\fPint[,int]
+Set the I/O priority value to use for I/Os that must be issued with a
+priority when \fBcmdprio_percentage\fR is set. If not specified when
+\fBcmdprio_percentage\fR is set, this defaults to 0. Linux limits us to
+a positive value between 0 and 7, with 0 being the highest. A single
+value applies to reads and writes. Comma-separated values may be specified
+for reads and writes. See man \fBionice\fR\|(1). Refer to an appropriate
+manpage for other operating systems since the meaning of priority may differ.
+See also the \fBprio\fR option.
+.TP
.BI (io_uring)fixedbufs
If fio is asked to do direct IO, then Linux will map pages for each IO call, and
release them when IO is done. If this option is set, the pages are pre-mapped
between 0 and 7, with 0 being the highest. See man
\fBionice\fR\|(1). Refer to an appropriate manpage for other operating
systems since meaning of priority may differ. For per-command priority
-setting, see the I/O engine specific `cmdprio_percentage` option.
+setting, see the I/O engine specific `cmdprio_percentage` and
+`cmdprio` options.
.TP
.BI prioclass \fR=\fPint
Set the I/O priority class. See man \fBionice\fR\|(1). For per-command
-priority setting, see the I/O engine specific `cmdprio_percentage` option.
+priority setting, see the I/O engine specific `cmdprio_percentage` and
+`cmdprio_class` options.
.TP
.BI cpus_allowed \fR=\fPstr
Controls the same options as \fBcpumask\fR, but accepts a textual
specific_options=ime_psync ime_psyncv
[ioengine_io_uring]
-specific_options=hipri cmdprio_percentage fixedbufs registerfiles sqthread_poll sqthread_poll_cpu nonvectored uncached nowait force_async
+specific_options=hipri cmdprio_percentage cmdprio_class cmdprio fixedbufs registerfiles sqthread_poll sqthread_poll_cpu nonvectored uncached nowait force_async
[ioengine_libaio]
-specific_options=userspace_reap cmdprio_percentage nowait
+specific_options=userspace_reap cmdprio_percentage cmdprio_class cmdprio nowait
[ioengine_libcufile]
specific_options=gpu_dev_ids cuda_io