madvise() vs posix_fadvise()

Dmitry Sivachenko trtrmitya at gmail.com
Fri Apr 4 21:02:14 UTC 2014


On 05 апр. 2014 г., at 0:12, John Baldwin <jhb at FreeBSD.org> wrote:

> 
> MADV_WILLNEED is not going to give you what you want.  OTOH, if you haven't
> tried FreeBSD 10 yet, I would suggest trying that.  There have been changes
> to pagedaemon that might make it do a better job of kicking out the pages
> of the log files automatically.
> 


I did. My situation became worse after I moved from stable/9 to stable/10.
My feeling is that stable/10 pushes rarely used mmaped pages out of RAM more aggressively than stable/9 did.

For now, the only solution I found is doing msync(MS_INVALIDATE) on log files after gzipping and after backup via rsync.
This moves corresponding memory pages from Inactive to Free and prevents system to occupy all free memory with cached log files and to purge mmaped data out of RAM to accomodate more disk cache.

What I would love to see is an ability to tell OS not to release mmaped data unless "really needed" (disk cache is not an excuse).


More information about the freebsd-hackers mailing list