madvise() vs posix_fadvise()

Ian Lepore ian at FreeBSD.org
Thu Apr 3 19:34:44 UTC 2014


On Thu, 2014-04-03 at 23:10 +0400, Dmitry Sivachenko wrote:
> On 03 апр. 2014 г., at 20:30, John Baldwin <jhb at FreeBSD.org> wrote:
> 
> > 
> > The latter.  It's sort of like a lazy O_DIRECT.  Each time you call write(2),
> > it tries to move any clean pages from your current sequentially written
> > stream from inactive to cache, so the pages won't move until a subsequent
> > write(2) after bufdaemon or the syncer actually forces them to be written.
> > Unfortunately, it is currently implemented by doing an internal
> > FADV_DONTNEED after each read() or write().  It would be better if it was
> > implemented as a callback when buffers are completed.
> 
> 
> 
> Sounds like FADV_NOREUSE should be befeficial for any log-writing program? (syslogd, apache, nginx, .....)

I'll probably do something with syslogd soon-ish, it'll help our
embedded products at $work that are tight on memory already.

-- Ian




More information about the freebsd-hackers mailing list