This can only impact kernels with INVARIANTS enabled, since we
unconditionally set busy_lock = VPB_UNBUSIED in vm_page_alloc().
However, before that we assert that the page is not busied. We
do the same in vm_page_free_toq().
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Well, both vm_page_alloc() and vm_page_free_toq() tolerate exclusive busied page, and I think that we sometimes free excl busy pages (but not shared busy).
Shouldn't the same treatment done for vm_page_insert() error case in vm_page_alloc_contig() ?
I should have qualified with "shared busied" in the description. I did notice that we may free exclusive busied pages and was wondering when this can actually occur. Do you know of a specific scenario?
Shouldn't the same treatment done for vm_page_insert() error case in vm_page_alloc_contig() ?
I missed that, thanks.
I believe this is very common e.g. in vm_fault(), where we insert busy page as the placeholder and the lock for the given address. Then, if we are unable to finish handling the request right now and have to retry, the page is just freed. Look at the vm_fault.c:unlock_and_deallocate(), both its code for fs->first_m release, and for calls to unlock_and_deallocate() in the fault handler.
But this is only the common example, I believe there are more. E.g. vm_pager_get_pages() on error should left the page busy, and it is common to just free it after.