-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: will io_uring block in this scenario in the same way as libaio? #1184
Comments
It will not block, io_uring is actually async, aio is just not. |
Much thanks for the speedy reply! What are the mechanics of that? Doesn't io_uring rely on the same NOWAIT-type infrastructure to ask the file system not to wait? Or is that already happening in an async context rather than inline with Basically it looks to me that on the |
I decided to try it, here's an example of the blocking I'm thinking about:
This is on a fast SSD so I set
|
|
XFS needs something like the below. Not really tested, may be daemons lurking... But it's certainly losing the NOWAIT flag, which is the bug here.
|
Thanks Jens, your response is much appreciated.
This is 6.5, but I believe the behavior is the same all the back to 5.x and forward to the tip.
Agreed, though This did come up before in this thread where the XFS maintainer mentioned that this requests-exhausted blocking case isn't interesting for Seastar users (Seastar was the example given there), but as a Seastar user I can say that we are definitely interested in this case and run into it in practice. Dave is correct that avoiding locking etc in the XFS layer is also very important but wrong in that it's the primary/only thing. Any blocking is problematic as userspace application has no way to avoid it if NOWAIT doens't work. |
Could very well be.
Not that many for DIO writes. ext4 adopted it for dio recently, btrfs still has its own iirc. I may be wrong, didn't double check. Dave isn't completely wrong, though xfs/iomap should do the right thing here. In practice it tends not to be a huge issue as nvme devices generally have very deep per-cpu queues, so risk of blocking is small. But it certainly can happen if the depth is more limited, or the device is driven too hard, and we should certainly get this blocking condition fixed. Your test case is 4k writes, which are easy enough. I'd be more nervous about longer looping where we've already done a bunch of writes and now we have one that blocks and returns -EAGAIN. Hence the devil is in the details here. Just back from 2 weeks away so don't have a lot of bandwidth to test this, but remind me end next week if I don't get back to you before then. |
My internal alarm clock is apparently very inaccurate, but a late ping is better than nothing I guess. We are still very interested in this. It is hard to see how to write effective write-heavy aio or liburing on XFS (which is "the" FS for these things) with this limitation: it is somehow worse than the opposite problem (where EAGAIN is returned when the kernel detects that blocking may occur, which is often too conservative) since there's nothing you can do about it once you block. |
Currently libaio-based IO may block in
io_submit(2)
even ifRWF_NOWAIT
is passed if we hit thenr_requests
limit of requests enqueued in the block layer. This is a death sentence for async thread-per-core architectures where if the only thread blocks all work stops.Will io_uring block in a similar way in
io_uring_enter
? I.e., does it try to do the same type of IO setup thatio_submit
does "sync" with the system call, relying on NOWAIT to ensure it doesn't block? Or does it always punt to some kernel thread to make those calls?Ref: https://lore.kernel.org/linux-block/[email protected]/
The text was updated successfully, but these errors were encountered: