4 ms·
There are different benefits and drawbacks of mmap. I only use mmap because it simplifies my code (I write experimental code). But the OP and commenters are mo
by sally1620 6y ago
There are different benefits and drawbacks of mmap. I only use mmap because it simplifies my code (I write experimental code).
But the OP and commenters are mostly concerned about the extra copy of read().
For video memory, DMABUF has been used to avoid extra copying. The idea is that the hardware directly DMAs into a buffer mapped in the userspace instead of copying into a kernel buffer and then copying into userspace. A system call is still involved, but no extra copying of data.
I wonder if anyone has actually implemented a disk I/O interface using DMABUF. There are a couple of low-level disk interfaces. But I don't know if any of them uses DMABUF.