Closed hansenidden18 closed 3 weeks ago
The io_uring_sqe struct is fixed, it doesn't matter how you setup the ring in terms of that, it won't change the definition of it. That would not be possible. Same goes for the cqe.
But if you setup with IORING_SETUP_SQE128
, the kernel will increment the sqring head by 2 for every consumed sqe. This means that you have a full io_uring_sqe worth of space BEHIND the sqe that you retrieve. Ditto for IORING_SETUP_CQE32
, a single cqe will take up two slots in the cq ring, making it twice the size of the io_uring_cqe struct itself.
Thank you for the kind response. I have a follow up questions. When I use io_uring, which is asynchronous, and compare it with ioctl, the result does not differ so much. Is it because I only call 1 ioctl and compare it with 1 iouring passthru?
If you don't build up some parallelism on the device side with io_uring, then you're just trading an odd ioctl for a submit+wait operation - the device side will be the same. So yes, to reap any benefits here (outside of using features like fixed/registered buffers), you'll also want to be driving more than a single IO at the time.
But in one of the slide in linux plumber it shows that a single job can outperform the ioctl itself. I tested it with 1 - 128 QD but the results I got was not as good as the presentation, do you know why? Thank you.
I'm not saying you need multiple jobs, I'm saying you need parallelism to get higher performance. If you do io_uring passthrough and use registered buffers, then even a single pending IO should be faster than the ioctl approach. Or if you have more pending, that would do it too, as there's no way to do that with the ioctl. And obviously a combination of both would be even better.
I can't say why your test doesn't perform, you're most likely missing one (or both) of those points.
Dear Developers,
To note I am running it in
Linux-6.8.0
andliburing-2.5
. I am trying to use Big SQE to take advantage 128 bytes of the SQE and use thesqe->cmd
for IO pasthrough. But after I initialize my ring with theIORING_SETUP_SQE128 | IORING_SETUP_CQE32
and try to print the SQE size andsqe->cmd
size, the result is still 64 and 0. That makes me not able to use thesqe->cmd
. Can you help? Thank you in advance!!my sqe initialization is like this
And the output will be
And here I tried it for read-write as well with the
sqe->cmd
same with the test inside the repo.the result is