| 864 | } |
| 865 | |
| 866 | static void |
| 867 | swapclear(struct proc *p) |
| 868 | { |
| 869 | struct thread *td; |
| 870 | |
| 871 | PROC_LOCK_ASSERT(p, MA_OWNED); |
| 872 | |
| 873 | FOREACH_THREAD_IN_PROC(p, td) { |
| 874 | thread_lock(td); |
| 875 | td->td_flags |= TDF_INMEM; |
| 876 | td->td_flags &= ~TDF_SWAPINREQ; |
| 877 | TD_CLR_SWAPPED(td); |
| 878 | if (TD_CAN_RUN(td)) { |
| 879 | if (setrunnable(td, 0)) { |
| 880 | #ifdef INVARIANTS |
| 881 | /* |
| 882 | * XXX: We just cleared TDI_SWAPPED |
| 883 | * above and set TDF_INMEM, so this |
| 884 | * should never happen. |
| 885 | */ |
| 886 | panic("not waking up swapper"); |
| 887 | #endif |
| 888 | } |
| 889 | } else |
| 890 | thread_unlock(td); |
| 891 | } |
| 892 | p->p_flag &= ~(P_SWAPPINGIN | P_SWAPPINGOUT); |
| 893 | p->p_flag |= P_INMEM; |
| 894 | } |
| 895 | |
| 896 | static int |
| 897 | swapout(struct proc *p) |
no test coverage detected