[PATCH] fadvise(2) system call

Alfred Perlstein alfred at freebsd.org
Wed Nov 9 11:08:50 UTC 2011


http://bit.ly/hwm4GC

* Tim Kientzle <tim at kientzle.com> [111108 22:18] wrote:
> 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

-- 
- Alfred Perlstein
.- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer


More information about the freebsd-arch mailing list