|
|
Subscribe / Log in / New account

BIO vs DIO

BIO vs DIO

Posted Jun 6, 2024 17:02 UTC (Thu) by joib (subscriber, #8541)
In reply to: BIO vs DIO by Paf
Parent article: Measuring and improving buffered I/O

Does the "Hybrid I/O" mean that it does some small buffered I/O for the head and tail of the data, and then nicely aligned direct I/O for the middle part?


to post comments

BIO vs DIO

Posted Jun 7, 2024 17:25 UTC (Fri) by Paf (subscriber, #91811) [Link]

No, unfortunately, because unalignment doesn't work like that. (That's what I hoped for when I started looking at it...)

Alignment means "byte N in this page of memory is byte N in a block on disk".

So let's say you want to do I/O from a 1 MiB malloc, and this 1 MiB buffer starts at 100 bytes into a page.

*Every* byte in the IO is 100 bytes off, and that means there's not a 1-to-1 mapping between pages in memory and page on disk. So you have to shift them *all*. Allocate a 1 MiB buffer and copy everything to it.

This is the same for the page cache, FWIW. It has to shift *everything*.

But since you can do the copying in parallel, it's still *really* fast.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds