The rapid growth of io_uring
The rapid growth of io_uring
Posted Jan 24, 2020 21:51 UTC (Fri) by axboe (subscriber, #904)In reply to: The rapid growth of io_uring by Sesse
Parent article: The rapid growth of io_uring
Posted Sep 2, 2021 12:36 UTC (Thu)
by awkravchuk (guest, #154070)
[Link] (8 responses)
Posted Sep 2, 2021 14:02 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (7 responses)
There's special cases in the kernel (but not, it appears, in the manpage) to allow file to anything splicing by allocating a secret internal pipe. Look at fs/splice.c, function splice_direct_to_actor for the code.
Posted Sep 2, 2021 16:49 UTC (Thu)
by awkravchuk (guest, #154070)
[Link] (6 responses)
Posted Sep 2, 2021 17:14 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (5 responses)
Looks like no way to use this from userspace.
However, in the io_uring case, you should be able to build a splice-based sendfile yourself using a pipe you create via pipe(2) to act as the buffer. Or do similar via fixed buffers in the ring instead of splice.
Posted Sep 2, 2021 17:40 UTC (Thu)
by awkravchuk (guest, #154070)
[Link]
Posted Nov 3, 2023 4:03 UTC (Fri)
by leo60228 (guest, #167812)
[Link] (3 responses)
Posted Nov 3, 2023 12:07 UTC (Fri)
by farnz (subscriber, #17727)
[Link] (2 responses)
If you're building your own equivalent of this trick in io_uring, you can have multiple splices in flight at once; you'd be using two linked SQEs, one of which splices input into the pipe, and the other of which splices the pipe into the output. Offset tracking is in your hands at this point.
The kernel's trick is simply to create the pipe for you if you don't provide one, and you're doing sync I/O from a file to something not-a-file.
Posted Nov 3, 2023 22:19 UTC (Fri)
by leo60228 (guest, #167812)
[Link] (1 responses)
Thinking about it more, I suppose this could be solved by creating a large number of pipes, and making sure that no two SQEs using the same pipe are in flight at the same time. I'm concerned that having many pipes could result in its own performance issues, but it'd probably be fine...?
Posted Nov 5, 2023 10:12 UTC (Sun)
by farnz (subscriber, #17727)
[Link]
You don't have one pipe for all splices; you have one pipe per splice. If the first SQE copies 0x4000 bytes, then the linked SQE can only copy 0x4000 bytes out of the pipe, because there's only 0x4000 bytes in there to copy out. This is exactly what the kernel trick is - create a temporary pipe for the splice to use, so that you're always splicing in and out of pipes.
The rapid growth of io_uring
The rapid growth of io_uring
The rapid growth of io_uring
Is there a way to use this from userspace? I'm not an actual kernel hacker, just trying io_uring out :)
The rapid growth of io_uring
The rapid growth of io_uring
The rapid growth of io_uring
The rapid growth of io_uring
The rapid growth of io_uring
The rapid growth of io_uring