Page MenuHomeFreeBSD

vm_page_alloc: Reset busy lock state if vm_page_insert_after() fails
ClosedPublic

Authored by markj on Jun 1 2016, 2:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 10:59 PM
Unknown Object (File)
Fri, Nov 8, 3:52 PM
Unknown Object (File)
Wed, Nov 6, 5:19 AM
Unknown Object (File)
Sep 27 2024, 1:08 PM
Unknown Object (File)
Sep 26 2024, 7:22 AM
Unknown Object (File)
Sep 26 2024, 7:22 AM
Unknown Object (File)
Sep 26 2024, 7:22 AM
Unknown Object (File)
Sep 26 2024, 6:48 AM
Subscribers

Details

Summary

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().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj retitled this revision from to vm_page_alloc: Reset busy lock state vm_page_insert_after() fails.
markj edited the test plan for this revision. (Show Details)
markj updated this object.
markj retitled this revision from vm_page_alloc: Reset busy lock state vm_page_insert_after() fails to vm_page_alloc: Reset busy lock state if vm_page_insert_after() fails.Jun 1 2016, 2:42 AM
markj updated this object.
markj added reviewers: alc, kib.

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() ?

In D6670#140741, @kib wrote:

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).

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.

markj edited edge metadata.

Reset the busy state in vm_page_alloc_contig() as well.

kib edited edge metadata.
In D6670#140742, @markj wrote:

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?

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.

This revision is now accepted and ready to land.Jun 1 2016, 3:49 AM
This revision was automatically updated to reflect the committed changes.