MADV_FREE and vm_page_dontneed()

RW rwmaillists at googlemail.com
Fri Dec 3 23:22:25 UTC 2010


Is there a good reason why physical memory pages released by
madvise(...,MADV_FREE) get handled by vm_page_dontneed()?

vm_page_dontneed() leaves page that are already in the inactive queue
where they are, and otherwise distributes pages between the active
queue, and the inactive queue's tail and head in the ratio 1:3:28. That
seems reasonable for  MADV_DONTNEED, but MADV_FREE pages are from freed
dynamic memory, so passing them to vm_page_dontneed() leads to wasted
pages building-up in the active and inactive queues.

Wouldn't it make more sense to move all eligible MADV_FREE pages to the
head of the inactive queue?



More information about the freebsd-hackers mailing list