public inbox for [email protected]
 help / color / mirror / Atom feed
* [FIO PATCH] engines/io_uring: delete fio_option_is_set() calls when submitting sqes
@ 2020-03-12 11:16 Xiaoguang Wang
  2020-03-12 12:59 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2020-03-12 11:16 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi

The fio_option_is_set() call in fio_ioring_prep() is time-consuming,
which will reduce sqe's submit rate drastically. To fix this issue,
add two new variables to record whether ioprio_class or ioprio_set
is set. I use a simple fio job to evaluate the performance:
    fio -name=fiotest -filename=/dev/nvme0n1 -iodepth=4 -thread -rw=read
    -ioengine=io_uring -hipri=0 -sqthread_poll=0 -direct=1 -bs=4k -size=10G
    -numjobs=1 -time_based -runtime=120

Before this patch:
  READ: bw=969MiB/s (1016MB/s), 969MiB/s-969MiB/s (1016MB/s-1016MB/s),
  io=114GiB (122GB), run=120001-120001msec

With this patch:
  READ: bw=1259MiB/s (1320MB/s), 1259MiB/s-1259MiB/s (1320MB/s-1320MB/s),
  io=148GiB (158GB), run=120001-120001msec

Signed-off-by: Xiaoguang Wang <[email protected]>
---
 engines/io_uring.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/engines/io_uring.c b/engines/io_uring.c
index 1efc6cf..ac57af8 100644
--- a/engines/io_uring.c
+++ b/engines/io_uring.c
@@ -63,6 +63,8 @@ struct ioring_data {
 	int queued;
 	int cq_ring_off;
 	unsigned iodepth;
+	bool ioprio_class_set;
+	bool ioprio_set;
 
 	struct ioring_mmap mmap[3];
 };
@@ -233,9 +235,9 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
 		}
 		if (!td->o.odirect && o->uncached)
 			sqe->rw_flags = RWF_UNCACHED;
-		if (fio_option_is_set(&td->o, ioprio_class))
+		if (ld->ioprio_class_set)
 			sqe->ioprio = td->o.ioprio_class << 13;
-		if (fio_option_is_set(&td->o, ioprio))
+		if (ld->ioprio_set)
 			sqe->ioprio |= td->o.ioprio;
 		sqe->off = io_u->offset;
 	} else if (ddir_sync(io_u->ddir)) {
@@ -685,6 +687,12 @@ static int fio_ioring_init(struct thread_data *td)
 		td_verror(td, EINVAL, "fio_io_uring_init");
 		return 1;
 	}
+
+	if (fio_option_is_set(&td->o, ioprio_class))
+		ld->ioprio_class_set = true;
+	if (fio_option_is_set(&td->o, ioprio))
+		ld->ioprio_set = true;
+
 	return 0;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-12 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-12 11:16 [FIO PATCH] engines/io_uring: delete fio_option_is_set() calls when submitting sqes Xiaoguang Wang
2020-03-12 12:59 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox