[PATCH] fadvise(2) system call

Tim Kientzle tim at kientzle.com
Wed Nov 9 06:18:17 UTC 2011


On Nov 8, 2011, at 8:35 PM, Alfred Perlstein wrote:

> A query to sysctl, perhaps 'vfs.bufspace' (I haven't bothered to
> look at the actual correct sysctl node to query) would give a real
> indication of the amount of buffer size there is.

The kernel knows the size of the file and knows how
much buffer cache there is.  So the kernel already knows
whether the file will fit.

>  If the file to
> extract is larger than that size, it would be pretty obvious to use
> the "will not need" flag for file access.

It's not at all obvious.

If I have 1GB of cache and I'm going
to generate and then read back a 2GB file,
the best strategy is to hold the first
1GB in cache.

If I'm going to write the file and it will never be
read back, then the best strategy is to not
cache any of it.

Sometimes, a program knows which of
these is likely, but if it doesn't know, it shouldn't
say.

Tim



More information about the freebsd-arch mailing list