2 * Copyright (c) 1991 Regents of the University of California.
4 * Copyright (c) 1994 John S. Dyson
6 * Copyright (c) 1994 David Greenman
8 * Copyright (c) 2005 Yahoo! Technologies Norway AS
11 * This code is derived from software contributed to Berkeley by
12 * The Mach Operating System project at Carnegie-Mellon University.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the University of
25 * California, Berkeley and its contributors.
26 * 4. Neither the name of the University nor the names of its contributors
27 * may be used to endorse or promote products derived from this software
28 * without specific prior written permission.
30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * from: @(#)vm_pageout.c 7.4 (Berkeley) 5/7/91
45 * Copyright (c) 1987, 1990 Carnegie-Mellon University.
46 * All rights reserved.
48 * Authors: Avadis Tevanian, Jr., Michael Wayne Young
50 * Permission to use, copy, modify and distribute this software and
51 * its documentation is hereby granted, provided that both the copyright
52 * notice and this permission notice appear in all copies of the
53 * software, derivative works or modified versions, and any portions
54 * thereof, and that both notices appear in supporting documentation.
56 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
57 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
58 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
60 * Carnegie Mellon requests users of this software to return to
62 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
63 * School of Computer Science
64 * Carnegie Mellon University
65 * Pittsburgh PA 15213-3890
67 * any improvements or extensions that they make and grant Carnegie the
68 * rights to redistribute these changes.
71 #include <sys/cdefs.h>
72 __FBSDID("$FreeBSD$");
74 #include "opt_kstack_pages.h"
75 #include "opt_kstack_max_pages.h"
78 #include <sys/param.h>
79 #include <sys/systm.h>
80 #include <sys/limits.h>
81 #include <sys/kernel.h>
82 #include <sys/eventhandler.h>
84 #include <sys/mutex.h>
86 #include <sys/_kstack_cache.h>
87 #include <sys/kthread.h>
89 #include <sys/mount.h>
90 #include <sys/racct.h>
91 #include <sys/resourcevar.h>
92 #include <sys/sched.h>
94 #include <sys/signalvar.h>
97 #include <sys/vnode.h>
98 #include <sys/vmmeter.h>
99 #include <sys/rwlock.h>
101 #include <sys/sysctl.h>
104 #include <vm/vm_param.h>
105 #include <vm/vm_object.h>
106 #include <vm/vm_page.h>
107 #include <vm/vm_map.h>
108 #include <vm/vm_pageout.h>
109 #include <vm/vm_pager.h>
110 #include <vm/vm_phys.h>
111 #include <vm/swap_pager.h>
112 #include <vm/vm_extern.h>
115 /* the kernel process "vm_daemon" */
116 static void vm_daemon(void);
117 static struct proc *vmproc;
119 static struct kproc_desc vm_kp = {
124 SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, kproc_start, &vm_kp);
126 static int vm_swap_enabled = 1;
127 static int vm_swap_idle_enabled = 0;
129 SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, CTLFLAG_RW,
131 "Enable entire process swapout");
132 SYSCTL_INT(_vm, OID_AUTO, swap_idle_enabled, CTLFLAG_RW,
133 &vm_swap_idle_enabled, 0,
134 "Allow swapout on idle criteria");
137 * Swap_idle_threshold1 is the guaranteed swapped in time for a process
139 static int swap_idle_threshold1 = 2;
140 SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold1, CTLFLAG_RW,
141 &swap_idle_threshold1, 0,
142 "Guaranteed swapped in time for a process");
145 * Swap_idle_threshold2 is the time that a process can be idle before
146 * it will be swapped out, if idle swapping is enabled.
148 static int swap_idle_threshold2 = 10;
149 SYSCTL_INT(_vm, OID_AUTO, swap_idle_threshold2, CTLFLAG_RW,
150 &swap_idle_threshold2, 0,
151 "Time before a process will be swapped out");
153 static int vm_pageout_req_swapout; /* XXX */
154 static int vm_daemon_needed;
155 static struct mtx vm_daemon_mtx;
156 /* Allow for use by vm_pageout before vm_daemon is initialized. */
157 MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF);
159 static int swapped_cnt;
160 static int swap_inprogress; /* Pending swap-ins done outside swapper. */
161 static int last_swapin;
163 static void swapclear(struct proc *);
164 static int swapout(struct proc *);
165 static void vm_swapout_map_deactivate_pages(vm_map_t, long);
166 static void vm_swapout_object_deactivate_pages(pmap_t, vm_object_t, long);
167 static void swapout_procs(int action);
168 static void vm_req_vmdaemon(int req);
169 static void vm_thread_swapout(struct thread *td);
172 * vm_swapout_object_deactivate_pages
174 * Deactivate enough pages to satisfy the inactive target
177 * The object and map must be locked.
180 vm_swapout_object_deactivate_pages(pmap_t pmap, vm_object_t first_object,
183 vm_object_t backing_object, object;
185 int act_delta, remove_mode;
187 VM_OBJECT_ASSERT_LOCKED(first_object);
188 if ((first_object->flags & OBJ_FICTITIOUS) != 0)
190 for (object = first_object;; object = backing_object) {
191 if (pmap_resident_count(pmap) <= desired)
193 VM_OBJECT_ASSERT_LOCKED(object);
194 if ((object->flags & OBJ_UNMANAGED) != 0 ||
195 object->paging_in_progress != 0)
199 if (object->shadow_count > 1)
202 * Scan the object's entire memory queue.
204 TAILQ_FOREACH(p, &object->memq, listq) {
205 if (pmap_resident_count(pmap) <= desired)
209 if (vm_page_busied(p))
211 PCPU_INC(cnt.v_pdpages);
213 if (p->wire_count != 0 || p->hold_count != 0 ||
214 !pmap_page_exists_quick(pmap, p)) {
218 act_delta = pmap_ts_referenced(p);
219 if ((p->aflags & PGA_REFERENCED) != 0) {
222 vm_page_aflag_clear(p, PGA_REFERENCED);
224 if (!vm_page_active(p) && act_delta != 0) {
226 p->act_count += act_delta;
227 } else if (vm_page_active(p)) {
228 if (act_delta == 0) {
229 p->act_count -= min(p->act_count,
231 if (!remove_mode && p->act_count == 0) {
233 vm_page_deactivate(p);
238 if (p->act_count < ACT_MAX -
240 p->act_count += ACT_ADVANCE;
243 } else if (vm_page_inactive(p))
247 if ((backing_object = object->backing_object) == NULL)
249 VM_OBJECT_RLOCK(backing_object);
250 if (object != first_object)
251 VM_OBJECT_RUNLOCK(object);
254 if (object != first_object)
255 VM_OBJECT_RUNLOCK(object);
259 * deactivate some number of pages in a map, try to do it fairly, but
260 * that is really hard to do.
263 vm_swapout_map_deactivate_pages(vm_map_t map, long desired)
266 vm_object_t obj, bigobj;
269 if (!vm_map_trylock_read(map))
276 * first, search out the biggest object, and try to free pages from
279 tmpe = map->header.next;
280 while (tmpe != &map->header) {
281 if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) {
282 obj = tmpe->object.vm_object;
283 if (obj != NULL && VM_OBJECT_TRYRLOCK(obj)) {
284 if (obj->shadow_count <= 1 &&
286 bigobj->resident_page_count <
287 obj->resident_page_count)) {
289 VM_OBJECT_RUNLOCK(bigobj);
292 VM_OBJECT_RUNLOCK(obj);
295 if (tmpe->wired_count > 0)
296 nothingwired = FALSE;
300 if (bigobj != NULL) {
301 vm_swapout_object_deactivate_pages(map->pmap, bigobj, desired);
302 VM_OBJECT_RUNLOCK(bigobj);
305 * Next, hunt around for other pages to deactivate. We actually
306 * do this search sort of wrong -- .text first is not the best idea.
308 tmpe = map->header.next;
309 while (tmpe != &map->header) {
310 if (pmap_resident_count(vm_map_pmap(map)) <= desired)
312 if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) {
313 obj = tmpe->object.vm_object;
315 VM_OBJECT_RLOCK(obj);
316 vm_swapout_object_deactivate_pages(map->pmap,
318 VM_OBJECT_RUNLOCK(obj);
325 * Remove all mappings if a process is swapped out, this will free page
328 if (desired == 0 && nothingwired) {
329 pmap_remove(vm_map_pmap(map), vm_map_min(map),
333 vm_map_unlock_read(map);
339 #define VM_SWAP_NORMAL 1
340 #define VM_SWAP_IDLE 2
347 vm_req_vmdaemon(VM_SWAP_NORMAL);
351 * Idle process swapout -- run once per second when pagedaemons are
355 vm_swapout_run_idle(void)
359 if (!vm_swap_idle_enabled || time_second == lsec)
361 vm_req_vmdaemon(VM_SWAP_IDLE);
366 vm_req_vmdaemon(int req)
368 static int lastrun = 0;
370 mtx_lock(&vm_daemon_mtx);
371 vm_pageout_req_swapout |= req;
372 if ((ticks > (lastrun + hz)) || (ticks < lastrun)) {
373 wakeup(&vm_daemon_needed);
376 mtx_unlock(&vm_daemon_mtx);
382 struct rlimit rsslim;
386 int breakout, swapout_flags, tryagain, attempts;
388 uint64_t rsize, ravailable;
392 mtx_lock(&vm_daemon_mtx);
393 msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep",
395 racct_enable ? hz : 0
400 swapout_flags = vm_pageout_req_swapout;
401 vm_pageout_req_swapout = 0;
402 mtx_unlock(&vm_daemon_mtx);
404 swapout_procs(swapout_flags);
407 * scan the processes for exceeding their rlimits or if
408 * process is swapped out -- deactivate pages
414 sx_slock(&allproc_lock);
415 FOREACH_PROC_IN_SYSTEM(p) {
416 vm_pindex_t limit, size;
419 * if this is a system process or if we have already
420 * looked at this process, skip it.
423 if (p->p_state != PRS_NORMAL ||
424 p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) {
429 * if the process is in a non-running type state,
433 FOREACH_THREAD_IN_PROC(p, td) {
435 if (!TD_ON_RUNQ(td) &&
436 !TD_IS_RUNNING(td) &&
437 !TD_IS_SLEEPING(td) &&
438 !TD_IS_SUSPENDED(td)) {
452 lim_rlimit_proc(p, RLIMIT_RSS, &rsslim);
454 qmin(rsslim.rlim_cur, rsslim.rlim_max));
457 * let processes that are swapped out really be
458 * swapped out set the limit to nothing (will force a
461 if ((p->p_flag & P_INMEM) == 0)
463 vm = vmspace_acquire_ref(p);
470 sx_sunlock(&allproc_lock);
472 size = vmspace_resident_count(vm);
474 vm_swapout_map_deactivate_pages(
476 size = vmspace_resident_count(vm);
480 rsize = IDX_TO_OFF(size);
482 if (p->p_state == PRS_NORMAL)
483 racct_set(p, RACCT_RSS, rsize);
484 ravailable = racct_get_available(p, RACCT_RSS);
486 if (rsize > ravailable) {
488 * Don't be overly aggressive; this
489 * might be an innocent process,
490 * and the limit could've been exceeded
491 * by some memory hog. Don't try
492 * to deactivate more than 1/4th
493 * of process' resident set size.
496 if (ravailable < rsize -
502 vm_swapout_map_deactivate_pages(
504 OFF_TO_IDX(ravailable));
505 /* Update RSS usage after paging out. */
506 size = vmspace_resident_count(vm);
507 rsize = IDX_TO_OFF(size);
509 if (p->p_state == PRS_NORMAL)
510 racct_set(p, RACCT_RSS, rsize);
512 if (rsize > ravailable)
518 sx_slock(&allproc_lock);
521 sx_sunlock(&allproc_lock);
522 if (tryagain != 0 && attempts <= 10) {
530 * Allow a thread's kernel stack to be paged out.
533 vm_thread_swapout(struct thread *td)
539 cpu_thread_swapout(td);
540 pages = td->td_kstack_pages;
541 ksobj = td->td_kstack_obj;
542 pmap_qremove(td->td_kstack, pages);
543 VM_OBJECT_WLOCK(ksobj);
544 for (i = 0; i < pages; i++) {
545 m = vm_page_lookup(ksobj, i);
547 panic("vm_thread_swapout: kstack already missing?");
550 vm_page_unwire(m, PQ_INACTIVE);
553 VM_OBJECT_WUNLOCK(ksobj);
557 * Bring the kernel stack for a specified thread back in.
560 vm_thread_swapin(struct thread *td, int oom_alloc)
563 vm_page_t ma[KSTACK_MAX_PAGES];
564 int a, count, i, j, pages, rv;
566 pages = td->td_kstack_pages;
567 ksobj = td->td_kstack_obj;
568 VM_OBJECT_WLOCK(ksobj);
569 (void)vm_page_grab_pages(ksobj, 0, oom_alloc | VM_ALLOC_WIRED, ma,
571 for (i = 0; i < pages;) {
572 vm_page_assert_xbusied(ma[i]);
573 if (ma[i]->valid == VM_PAGE_BITS_ALL) {
574 vm_page_xunbusy(ma[i]);
578 vm_object_pip_add(ksobj, 1);
579 for (j = i + 1; j < pages; j++)
580 if (ma[j]->valid == VM_PAGE_BITS_ALL)
582 rv = vm_pager_has_page(ksobj, ma[i]->pindex, NULL, &a);
583 KASSERT(rv == 1, ("%s: missing page %p", __func__, ma[i]));
584 count = min(a + 1, j - i);
585 rv = vm_pager_get_pages(ksobj, ma + i, count, NULL, NULL);
586 KASSERT(rv == VM_PAGER_OK, ("%s: cannot get kstack for proc %d",
587 __func__, td->td_proc->p_pid));
588 vm_object_pip_wakeup(ksobj);
589 for (j = i; j < i + count; j++)
590 vm_page_xunbusy(ma[j]);
593 VM_OBJECT_WUNLOCK(ksobj);
594 pmap_qenter(td->td_kstack, ma, pages);
595 cpu_thread_swapin(td);
599 faultin(struct proc *p)
604 PROC_LOCK_ASSERT(p, MA_OWNED);
607 * If another process is swapping in this process,
608 * just wait until it finishes.
610 if (p->p_flag & P_SWAPPINGIN) {
611 while (p->p_flag & P_SWAPPINGIN)
612 msleep(&p->p_flag, &p->p_mtx, PVM, "faultin", 0);
616 if ((p->p_flag & P_INMEM) == 0) {
617 oom_alloc = (p->p_flag & P_WKILLED) != 0 ? VM_ALLOC_SYSTEM :
621 * Don't let another thread swap process p out while we are
622 * busy swapping it in.
625 p->p_flag |= P_SWAPPINGIN;
627 sx_xlock(&allproc_lock);
628 MPASS(swapped_cnt > 0);
630 if (curthread != &thread0)
632 sx_xunlock(&allproc_lock);
635 * We hold no lock here because the list of threads
636 * can not change while all threads in the process are
639 FOREACH_THREAD_IN_PROC(p, td)
640 vm_thread_swapin(td, oom_alloc);
642 if (curthread != &thread0) {
643 sx_xlock(&allproc_lock);
644 MPASS(swap_inprogress > 0);
647 sx_xunlock(&allproc_lock);
653 /* Allow other threads to swap p out now. */
660 * This swapin algorithm attempts to swap-in processes only if there
661 * is enough space for them. Of course, if a process waits for a long
662 * time, it will be swapped in anyway.
666 swapper_selector(bool wkilled_only)
668 struct proc *p, *res;
670 int ppri, pri, slptime, swtime;
672 sx_assert(&allproc_lock, SA_SLOCKED);
673 if (swapped_cnt == 0)
677 FOREACH_PROC_IN_SYSTEM(p) {
679 if (p->p_state == PRS_NEW || (p->p_flag & (P_SWAPPINGOUT |
680 P_SWAPPINGIN | P_INMEM)) != 0) {
684 if (p->p_state == PRS_NORMAL && (p->p_flag & P_WKILLED) != 0) {
686 * A swapped-out process might have mapped a
687 * large portion of the system's pages as
688 * anonymous memory. There is no other way to
689 * release the memory other than to kill the
690 * process, for which we need to swap it in.
698 swtime = (ticks - p->p_swtick) / hz;
699 FOREACH_THREAD_IN_PROC(p, td) {
701 * An otherwise runnable thread of a process
702 * swapped out has only the TDI_SWAPPED bit set.
705 if (td->td_inhibitors == TDI_SWAPPED) {
706 slptime = (ticks - td->td_slptick) / hz;
707 pri = swtime + slptime;
708 if ((td->td_flags & TDF_SWAPINREQ) == 0)
709 pri -= p->p_nice * 8;
711 * if this thread is higher priority
712 * and there is enough space, then select
713 * this process instead of the previous
731 #define SWAPIN_INTERVAL (MAXSLP * hz / 2)
734 * Limit swapper to swap in one non-WKILLED process in MAXSLP/2
735 * interval, assuming that there is:
736 * - no memory shortage;
737 * - no parallel swap-ins;
738 * - no other swap-ins in the current SWAPIN_INTERVAL.
741 swapper_wkilled_only(void)
744 return (vm_page_count_min() || swap_inprogress > 0 ||
745 (u_int)(ticks - last_swapin) < SWAPIN_INTERVAL);
754 sx_slock(&allproc_lock);
755 p = swapper_selector(swapper_wkilled_only());
756 sx_sunlock(&allproc_lock);
759 tsleep(&proc0, PVM, "swapin", SWAPIN_INTERVAL);
761 PROC_LOCK_ASSERT(p, MA_OWNED);
764 * Another process may be bringing or may have
765 * already brought this process in while we
766 * traverse all threads. Or, this process may
767 * have exited or even being swapped out
770 if (p->p_state == PRS_NORMAL && (p->p_flag & (P_INMEM |
771 P_SWAPPINGOUT | P_SWAPPINGIN)) == 0) {
780 * First, if any processes have been sleeping or stopped for at least
781 * "swap_idle_threshold1" seconds, they are swapped out. If, however,
782 * no such processes exist, then the longest-sleeping or stopped
783 * process is swapped out. Finally, and only as a last resort, if
784 * there are no sleeping or stopped processes, the longest-resident
785 * process is swapped out.
788 swapout_procs(int action)
793 bool didswap, doswap;
795 MPASS((action & (VM_SWAP_NORMAL | VM_SWAP_IDLE)) != 0);
798 sx_slock(&allproc_lock);
799 FOREACH_PROC_IN_SYSTEM(p) {
801 * Filter out not yet fully constructed processes. Do
802 * not swap out held processes. Avoid processes which
803 * are system, exiting, execing, traced, already swapped
804 * out or are in the process of being swapped in or out.
807 if (p->p_state != PRS_NORMAL || p->p_lock != 0 || (p->p_flag &
808 (P_SYSTEM | P_WEXIT | P_INEXEC | P_STOPPED_SINGLE |
809 P_TRACED | P_SWAPPINGOUT | P_SWAPPINGIN | P_INMEM)) !=
816 * Further consideration of this process for swap out
817 * requires iterating over its threads. We release
818 * allproc_lock here so that process creation and
819 * destruction are not blocked while we iterate.
821 * To later reacquire allproc_lock and resume
822 * iteration over the allproc list, we will first have
823 * to release the lock on the process. We place a
824 * hold on the process so that it remains in the
825 * allproc list while it is unlocked.
828 sx_sunlock(&allproc_lock);
831 * Do not swapout a realtime process.
832 * Guarantee swap_idle_threshold1 time in memory.
833 * If the system is under memory stress, or if we are
834 * swapping idle processes >= swap_idle_threshold2,
835 * then swap the process out.
838 FOREACH_THREAD_IN_PROC(p, td) {
840 slptime = (ticks - td->td_slptick) / hz;
841 if (PRI_IS_REALTIME(td->td_pri_class) ||
842 slptime < swap_idle_threshold1 ||
843 !thread_safetoswapout(td) ||
844 ((action & VM_SWAP_NORMAL) == 0 &&
845 slptime < swap_idle_threshold2))
851 if (doswap && swapout(p) == 0)
856 sx_xlock(&allproc_lock);
858 sx_downgrade(&allproc_lock);
860 sx_slock(&allproc_lock);
863 sx_sunlock(&allproc_lock);
866 * If we swapped something out, and another process needed memory,
867 * then wakeup the sched process.
874 swapclear(struct proc *p)
878 PROC_LOCK_ASSERT(p, MA_OWNED);
880 FOREACH_THREAD_IN_PROC(p, td) {
882 td->td_flags |= TDF_INMEM;
883 td->td_flags &= ~TDF_SWAPINREQ;
886 if (setrunnable(td)) {
889 * XXX: We just cleared TDI_SWAPPED
890 * above and set TDF_INMEM, so this
891 * should never happen.
893 panic("not waking up swapper");
898 p->p_flag &= ~(P_SWAPPINGIN | P_SWAPPINGOUT);
899 p->p_flag |= P_INMEM;
903 swapout(struct proc *p)
907 PROC_LOCK_ASSERT(p, MA_OWNED);
910 * The states of this process and its threads may have changed
911 * by now. Assuming that there is only one pageout daemon thread,
912 * this process should still be in memory.
914 KASSERT((p->p_flag & (P_INMEM | P_SWAPPINGOUT | P_SWAPPINGIN)) ==
915 P_INMEM, ("swapout: lost a swapout race?"));
918 * Remember the resident count.
920 p->p_vmspace->vm_swrss = vmspace_resident_count(p->p_vmspace);
923 * Check and mark all threads before we proceed.
925 p->p_flag &= ~P_INMEM;
926 p->p_flag |= P_SWAPPINGOUT;
927 FOREACH_THREAD_IN_PROC(p, td) {
929 if (!thread_safetoswapout(td)) {
934 td->td_flags &= ~TDF_INMEM;
938 td = FIRST_THREAD_IN_PROC(p);
939 ++td->td_ru.ru_nswap;
943 * This list is stable because all threads are now prevented from
944 * running. The list is only modified in the context of a running
945 * thread in this process.
947 FOREACH_THREAD_IN_PROC(p, td)
948 vm_thread_swapout(td);
951 p->p_flag &= ~P_SWAPPINGOUT;