:When I implemented MADV_DONTNEED and MADV_FREE in NetBSD (UVM): : : DONTNEED: deactivate pages
There are some medium sized problems with doing this under FreeBSD, mainly that this will cause the pages to recycle through the inactive and cache queues. Without anything to bump the page daemon you can get into a silly-recycle state when the inactive and cache page queues are too small. For example, if you have 64MB of main memory, 50MB active, 5MB inactive, and 8MB cache, and you scan a 16MB file. This file would trivially fit into main memory but the silly-recycle problem causes it to essentially be completely flushed. We also have another problem: By recycling the pages into the inactive queue we essentially flush the inactive & cache queues when scanning very large objects even though it is a complete waste of memory to do so since the whole of the object will go down the drain anyway... it would have been much, much better to cycle the cache in that case and leave the inactive queue intact. I am working on a solution that attempts to slowly balance the paging queues while at the same time optimizing which queue the madvised page is moved to. If we do it right, it should be possible to scan very large objects without destroying the rest of the VM cache. : FREE: don't clean dirty pages, free all pages in range : :It was fairly straightforward in NetBSD. Yes, we already do this, but only for OBJT_DEFAULT and OBJT_SWAP objects. We do not do this for file objects... it would make me rather nervous if we did :-) : -- Jason R. Thorpe <thor...@nas.nasa.gov> -Matt Matthew Dillon <dil...@backplane.com> To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-hackers" in the body of the message