Add a new function vm_page_free_invalid() for freeing invalid pages
that might be wired. If the page is wired then it cannot be freed now, but the thread that eventually unwires it will free it at that point. Reviewed by: markj, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D25430
This commit is contained in:
parent
c3dbadc1fd
commit
4dfa06e114
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363295
@ -1361,6 +1361,31 @@ vm_page_readahead_finish(vm_page_t m)
|
|||||||
vm_page_xunbusy_unchecked(m);
|
vm_page_xunbusy_unchecked(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Destroy the identity of an invalid page and free it if possible.
|
||||||
|
* This is intended to be used when reading a page from backing store fails.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
vm_page_free_invalid(vm_page_t m)
|
||||||
|
{
|
||||||
|
|
||||||
|
KASSERT(vm_page_none_valid(m), ("page %p is valid", m));
|
||||||
|
KASSERT(!pmap_page_is_mapped(m), ("page %p is mapped", m));
|
||||||
|
vm_page_assert_xbusied(m);
|
||||||
|
KASSERT(m->object != NULL, ("page %p has no object", m));
|
||||||
|
VM_OBJECT_ASSERT_WLOCKED(m->object);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If someone has wired this page while the object lock
|
||||||
|
* was not held, then the thread that unwires is responsible
|
||||||
|
* for freeing the page. Otherwise just free the page now.
|
||||||
|
* The wire count of this unmapped page cannot change while
|
||||||
|
* we have the page xbusy and the page's object wlocked.
|
||||||
|
*/
|
||||||
|
if (vm_page_remove(m))
|
||||||
|
vm_page_free(m);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vm_page_sleep_if_busy:
|
* vm_page_sleep_if_busy:
|
||||||
*
|
*
|
||||||
|
@ -629,6 +629,7 @@ void vm_page_deactivate_noreuse(vm_page_t);
|
|||||||
void vm_page_dequeue(vm_page_t m);
|
void vm_page_dequeue(vm_page_t m);
|
||||||
void vm_page_dequeue_deferred(vm_page_t m);
|
void vm_page_dequeue_deferred(vm_page_t m);
|
||||||
vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);
|
vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);
|
||||||
|
void vm_page_free_invalid(vm_page_t);
|
||||||
vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
|
vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
|
||||||
void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
|
void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
|
||||||
int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
|
int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user