Re: cache limit

From: Andrew Morton
Date: Tue Aug 19 2003 - 01:33:22 EST


Denis Vlasenko <vda@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> There was a discussion (and patches) in the middle of 2.5 series
> about O_STREAMING open flag which mean "do not aggressively cache
> this file". Targeted at MP3/video playing, copying large files and such.
>
> I don't know whether it actually was merged. If it was,
> your program can use it.

It was not. Instead we have fadvise. So it would be appropriate to change
applications such as rsync to optionally run

posix_fadvise(fd, 0, -1, POSIX_FADV_DONTNEED)

against file descriptors just before closing them, so all the pagecache
gets thrown away. (Well, most of the pagecache - dirty pages won't get
dropped - the app must fsync the files by hand first if it wants this)

This would be a useful addition to rsync and such applications - it is
stronger and more specific and safer than banging on the VM for a special
case.

But if you want to bang on the VM for a special case, run 2.6 and set
/proc/sys/vm/swappiness to zero during the rsync run.

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