Re: O_DIRECT question

From: Andrew Morton
Date: Fri Jan 12 2007 - 17:49:27 EST


On Fri, 12 Jan 2007 15:35:09 -0700
Erik Andersen <andersen@xxxxxxxxxxxx> wrote:

> On Fri Jan 12, 2007 at 05:09:09PM -0500, Linus Torvalds wrote:
> > I suspect a lot of people actually have other reasons to avoid caches.
> >
> > For example, the reason to do O_DIRECT may well not be that you want to
> > avoid caching per se, but simply because you want to limit page cache
> > activity. In which case O_DIRECT "works", but it's really the wrong thing
> > to do. We could export other ways to do what people ACTUALLY want, that
> > doesn't have the downsides.
>
> I was rather fond of the old O_STREAMING patch by Robert Love,

That was an akpmpatch whcih I did for the Digeo kernel. Robert picked it
up to dehackify it and get it into mainline, but we ended up deciding that
posix_fadvise() was the way to go because it's standards-based.

It's a bit more work in the app to use posix_fadvise() well. But the
results will be better. The app should also use sync_file_range()
intelligently to control its pagecache use.

The problem with all of these things is that the application needs to be
changed, and people often cannot do that. If we want a general way of
stopping particular apps from swamping pagecache then it'd really need to
be an externally-imposed thing - probably via additional accounting and a
new rlimit.

-
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/