[lkml]   [2014]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectOld O_DIRECT story
Hi, all.
There was a discussion here:

Linus wrote in this discussion:
"So don't use O_DIRECT. Use things like madvise() and posix_fadvise()

After the full week of tests, searches, discussions, I have impudence to
turn to the community - has one tried to implement this approach?

The situation is very simple:
I have the incoming DMA stream using scatter/gather technique. the driver
read() function provides the next ready DMA buffer descriptor with the
virtual address pointer to the acquired data. I need to store this data to
the disk partition as fast as possible, as the incoming stream is too very
fast. According to tests, O_DIRECT/mapping is fast enough, while write() is

I tried in all ways to implement this with mmap(), but it does not success,
because I did not find a way to mmap() file as O_WRONLY. Mapping as O_RDWR
makes kernel to pre-fill mapped memory with partition data. So, kernel and
DMA actually compete on the RAM area to fill it - one with garbage, one
with actual data. Kernel wins.

So, how to implement Linus's advice?

 \ /
  Last update: 2014-12-27 14:41    [W:0.180 / U:2.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site