From: Jens Axboe <[email protected]>
To: [email protected], [email protected], [email protected]
Subject: Re: [PATCH v2 1/4] fsstress: add IO_URING read and write operations
Date: Sat, 22 Aug 2020 12:05:09 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 8/22/20 12:14 PM, Zorro Lang wrote:
>>> + if ((e = io_uring_submit(&ring)) != 1) {
>>> + if (v)
>>> + printf("%d/%d: %s - io_uring_submit failed %d\n", procid, opno,
>>> + iswrite ? "uring_write" : "uring_read", e);
>>> + goto uring_out1;
>>> + }
>>> + if ((e = io_uring_wait_cqe(&ring, &cqe)) < 0) {
>>> + if (v)
>>> + printf("%d/%d: %s - io_uring_wait_cqe failed %d\n", procid, opno,
>>> + iswrite ? "uring_write" : "uring_read", e);
>>> + goto uring_out1;
>>> + }
>>
>> You could use io_uring_submit_and_wait() here, that'll save a system
>> call for sync IO. Same comment goes for 4/4.
>
> Hi Jens,
>
> Sorry I think I haven't learned about io_uring enough, why the
> io_uring_submit_and_wait can save a system call? Is it same with
> io_uring_submit(), except a wait_nr ? The io_uring_wait_cqe() and
> io_uring_cqe_seen() are still needed, right?
If you just call io_uring_submit(), it'll enter the kernel and submit
that IO. Then right after that you're saying "I want to wait for
completion of a request", which is then another system call. If you do
io_uring_submit_and_wait() you're entering the kernel with the intent of
"submit my request(s), and wait for N requests" hence only doing a
single system call even though it's an async interface.
Nothing else changes, io_uring_wait_cqe() will not enter the kernel if a
cqe is available in the ring already.
--
Jens Axboe
next prev parent reply other threads:[~2020-08-22 18:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-09 6:30 [PATCH v2 0/4] fsstress,fsx: add io_uring test and do some fix Zorro Lang
2020-08-09 6:30 ` [PATCH v2 1/4] fsstress: add IO_URING read and write operations Zorro Lang
2020-08-09 17:51 ` Jens Axboe
2020-08-22 18:14 ` Zorro Lang
2020-08-22 18:05 ` Jens Axboe [this message]
2020-08-09 6:30 ` [PATCH v2 2/4] fsstress: reduce the number of events when io_setup Zorro Lang
2020-08-09 6:30 ` [PATCH v2 3/4] fsstress: fix memory leak in do_aio_rw Zorro Lang
2020-08-09 6:30 ` [PATCH v2 4/4] fsx: add IO_URING test Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox