Re: mmap vs. O_DIRECT

From: Robert Love
Date: Thu Nov 11 2004 - 10:43:43 EST


On Thu, 2004-11-11 at 09:50 -0500, Bill Davidsen wrote:

> I miss your point about synchronous, with hundreds of clients doing
> small reads against a 10TB database, the benefit of pushing them through
> the page cache isn't obvious. No particular data are in memory long
> enough to have much chance of being shared, so it looks like overhead to
> me. Feel free to educate me.

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

> I certainly DO want to put more users per server, and direct I/O has
> proven itself in actual use. I'm not sure why you think the double copy
> is a good thing, but I have good rea$on to want more users per server.
>
> Alan: point on MAP_SHARED taken.

BTW, Alan's point on MAP_SHARED is just that you can have the mmap
region and the page cached region be one and the same. You still aren't
doing direct I/O.

Maybe that is ultimately what you want.

It is rare to see direct I/O perform better when you use it as normal
file I/O (e.g. don't perform your own caching and scheduling) but if you
really do measure improvements, and if you never reaccess the data (and
thus the lack of cache is not a problem), then by all means use it.

But we still don't want to make normal mmap's be direct.

Robert Love


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/