Re: mmap vs. O_DIRECT

Robert Love
2004-11-11T17:12:56Z

On Thu, 2004-11-11 at 10:41 -0500, Robert Love wrote:

> There is a difference between being synchronous and not going through
> the page cache, although in Linux we don't really have the distinction.

Rereading this, I should clarify. We definitely have the distinction.

In the case of direct I/O, you get synchronousness, no page caching, and
no use of buffers. In my statement, I meant that you cannot separate
the "no page cache" from the "synchronousness" attribute.

But you can get synchronous I/O and still get the page cache, ala
O_SYNC.

The closest you can come to normal I/O without the page cache is by
doing posix_fadvise() to prune your cache pages after you touch them.
That is definitely not what you want.

Robert Love