Re: O_DIRECT! or O_DIRECT?

Stephen C. Tweedie
2001-07-04T18:34:38Z

Hi,

On Wed, Jul 04, 2001 at 06:27:13PM +0000, Miquel van Smoorenburg wrote:
> In article <20010704185230.F28793@redhat.com>,
> Stephen C. Tweedie <sct@redhat.com> wrote:
> >For these reasons, buffered IO is often faster than O_DIRECT for pure
> >sequential access. The downside it its greater CPU cost and the fact
> >that it pollutes the cache (which, in turn, causes even _more_ CPU
> >overhead when the VM is forced to start reclaiming old cache data to
> >make room for new blocks.)
>
> Any chance of something like O_SEQUENTIAL (like madvise(MADV_SEQUENTIAL))

What for? The kernel already optimises readahead and writebehind for
sequential files.

If you want to provide specific extra hints to the kernel, then things
like O_UNCACHE might be more appropriate to instruct the kernel to
explicitly remove the cached page after IO completes (to avoid the VM
overhead of maintaining useless cache). That would provide a definite
improvement over normal IO for large multimedia-style files or for
huge copies. But what part of the normal handling of sequential files
would O_SEQUENTIAL change? Good handling of sequential files should
be the default, not an explicitly-requested feature.

Cheers,
Stephen