[MPlayer-dev-eng] [PATCH] Use posix_fadvise in stream_file if available

Uoti Urpala uoti.urpala at pp1.inet.fi
Sat Nov 7 20:22:38 CET 2009


On Sat, 2009-11-07 at 20:06 +0100, Reimar Döffinger wrote:
> Also I don't think this is supposed to be s->pos, like this you'll
> advise the kernel to read ahead the data it just read while almost
> certainly it would make more sense to tell the kernel to drop that part.

> posix_fadvise(s->fd, pos, max_len, POSIX_FADV_DONTNEED);

I think that's a bad idea. At least on Linux POSIX_FADV_DONTNEED seems
to make the kernel always drop the data from the cache instantly, even
if there is no memory pressure. So this would require filesystem reads
for every seek. It'd also completely prevent the file from being in
cache after playback, and even drop it from the cache if it was already
there.

If the behavior of DONTNEED was only "schedule this to be dropped from
cache first in case of memory pressure" then this could be beneficial.
But currently it isn't.




More information about the MPlayer-dev-eng mailing list