MCPcopy Create free account
hub / github.com/F-Stack/f-stack / swap_pager_dealloc

Function swap_pager_dealloc

freebsd/vm/swap_pager.c:737–768  ·  view source on GitHub ↗

* SWAP_PAGER_DEALLOC() - remove swap metadata from object * * The swap backing for the object is destroyed. The code is * designed such that we can reinstantiate it later, but this * routine is typically called only when the entire object is * about to be destroyed. * * The object must be locked. */

Source from the content-addressed store, hash-verified

735 * The object must be locked.
736 */
737static void
738swap_pager_dealloc(vm_object_t object)
739{
740
741 VM_OBJECT_ASSERT_WLOCKED(object);
742 KASSERT((object->flags & OBJ_DEAD) != 0, ("dealloc of reachable obj"));
743
744 /*
745 * Remove from list right away so lookups will fail if we block for
746 * pageout completion.
747 */
748 if ((object->flags & OBJ_ANON) == 0 && object->handle != NULL) {
749 VM_OBJECT_WUNLOCK(object);
750 sx_xlock(&sw_alloc_sx);
751 TAILQ_REMOVE(NOBJLIST(object->handle), object,
752 pager_object_list);
753 sx_xunlock(&sw_alloc_sx);
754 VM_OBJECT_WLOCK(object);
755 }
756
757 vm_object_pip_wait(object, "swpdea");
758
759 /*
760 * Free all remaining metadata. We only bother to free it from
761 * the swap meta data. We do not attempt to free swapblk's still
762 * associated with vm_page_t's for this object. We do not care
763 * if paging is still in progress on some objects.
764 */
765 swp_pager_meta_free_all(object);
766 object->handle = NULL;
767 object->type = OBJT_DEAD;
768}
769
770/************************************************************************
771 * SWAP PAGER BITMAP ROUTINES *

Callers

nothing calls this directly

Calls 2

vm_object_pip_waitFunction · 0.85
swp_pager_meta_free_allFunction · 0.85

Tested by

no test coverage detected