http://kerneltrap.org/node/7563

So Linus really hates O_DIRECT on files and can see no good use for it. In the referenced white paper Andrea suggests the use of O_DIRECT to eliminate CPU and memory bandwidth consumption during the process of copying to/from user space.

Indeed, lets say I have an embedded system (CPU bandwidth is not abundant). I have a device which is providing an almost never-ending stream of data. This data is DMA'ed into a large physically contiguous buffer which is mapped into a process's address space.

I want to write the data in this buffer out to a file without the CPU actually having to copy the data. O_DIRECT seems like the perfect mechanism -- the buffer will ultimately get DMA'ed straight out of my user-space buffer and out to disk (assuming I meet alignment requirements, etc...).

If O_DIRECT is frowned upon, what is the prescribed method for accomplishing a zero-copy data movement from kernel->user->kernel?

I looked at the madvise() and posix_fadvise() calls but they only seem to alter the cache behavior -- not eliminate it. And if I don't eliminate it, a copy is still taking place (unless there paging magic at play).

This question may have already been asked a whole bunch and I apologize in advance if it has (there is a lot of noise surrounding a search of "O_DIRECT").

Thanks!
-Miles

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to