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

Function swp_pager_freeswapspace

freebsd/vm/swap_pager.c:875–902  ·  view source on GitHub ↗

* SWP_PAGER_FREESWAPSPACE() - free raw swap space * * This routine returns the specified swap blocks back to the bitmap. * * This routine may not sleep. */

Source from the content-addressed store, hash-verified

873 * This routine may not sleep.
874 */
875static void
876swp_pager_freeswapspace(daddr_t blk, daddr_t npages)
877{
878 struct swdevt *sp;
879
880 if (npages == 0)
881 return;
882 mtx_lock(&sw_dev_mtx);
883 TAILQ_FOREACH(sp, &swtailq, sw_list) {
884 if (swp_pager_isondev(blk, sp)) {
885 sp->sw_used -= npages;
886 /*
887 * If we are attempting to stop swapping on
888 * this device, we don't want to mark any
889 * blocks free lest they be reused.
890 */
891 if ((sp->sw_flags & SW_CLOSING) == 0) {
892 blist_free(sp->sw_blist, blk - sp->sw_first,
893 npages);
894 swap_pager_avail += npages;
895 swp_sizecheck();
896 }
897 mtx_unlock(&sw_dev_mtx);
898 return;
899 }
900 }
901 panic("Swapdev not found");
902}
903
904/*
905 * SYSCTL_SWAP_FRAGMENTATION() - produce raw swap space stats

Callers 6

swap_pager_reserveFunction · 0.85
swap_pager_unswappedFunction · 0.85
swap_pager_putpagesFunction · 0.85
swp_pager_meta_transferFunction · 0.85
swp_pager_meta_free_allFunction · 0.85

Calls 6

swp_pager_isondevFunction · 0.85
blist_freeFunction · 0.85
swp_sizecheckFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected