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

Function swapper

freebsd/vm/vm_swapout.c:741–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741void
742swapper(void)
743{
744 struct proc *p;
745
746 for (;;) {
747 sx_slock(&allproc_lock);
748 p = swapper_selector(swapper_wkilled_only());
749 sx_sunlock(&allproc_lock);
750
751 if (p == NULL) {
752 tsleep(&proc0, PVM, "swapin", SWAPIN_INTERVAL);
753 } else {
754 PROC_LOCK_ASSERT(p, MA_OWNED);
755
756 /*
757 * Another process may be bringing or may have
758 * already brought this process in while we
759 * traverse all threads. Or, this process may
760 * have exited or even being swapped out
761 * again.
762 */
763 if (p->p_state == PRS_NORMAL && (p->p_flag & (P_INMEM |
764 P_SWAPPINGOUT | P_SWAPPINGIN)) == 0) {
765 faultin(p);
766 }
767 PROC_UNLOCK(p);
768 }
769 }
770}
771
772/*
773 * First, if any processes have been sleeping or stopped for at least

Callers 1

mi_startupFunction · 0.50

Calls 3

swapper_selectorFunction · 0.85
swapper_wkilled_onlyFunction · 0.85
faultinFunction · 0.70

Tested by

no test coverage detected