vm_pageout.c (3614c6fcbb5692a2306cc3ec5afcc8e561645a69) | vm_pageout.c (ff2b5645b505b75fccf4719513374271a33ed80c) |
---|---|
1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 1125 unchanged lines hidden (view full) --- 1134 if (vm_swap_enabled && vm_page_count_target()) { 1135 vm_req_vmdaemon(); 1136 vm_pageout_req_swapout |= VM_SWAP_NORMAL; 1137 } 1138#endif 1139 } 1140 1141 /* | 1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 1125 unchanged lines hidden (view full) --- 1134 if (vm_swap_enabled && vm_page_count_target()) { 1135 vm_req_vmdaemon(); 1136 vm_pageout_req_swapout |= VM_SWAP_NORMAL; 1137 } 1138#endif 1139 } 1140 1141 /* |
1142 * make sure that we have swap space -- if we are low on memory and 1143 * swap -- then kill the biggest process. | 1142 * If we are out of swap and were not able to reach our paging 1143 * target, kill the largest process. |
1144 * 1145 * We keep the process bigproc locked once we find it to keep anyone 1146 * from messing with it; however, there is a possibility of 1147 * deadlock if process B is bigproc and one of it's child processes 1148 * attempts to propagate a signal to B while we are waiting for A's 1149 * lock while walking this list. To avoid this, we don't block on 1150 * the process lock but just skip a process if it is already locked. 1151 */ | 1144 * 1145 * We keep the process bigproc locked once we find it to keep anyone 1146 * from messing with it; however, there is a possibility of 1147 * deadlock if process B is bigproc and one of it's child processes 1148 * attempts to propagate a signal to B while we are waiting for A's 1149 * lock while walking this list. To avoid this, we don't block on 1150 * the process lock but just skip a process if it is already locked. 1151 */ |
1152 if ((vm_swap_size < 64 && vm_page_count_min()) || 1153 (swap_pager_full && vm_paging_target() > 0)) { 1154#if 0 |
|
1152 if ((vm_swap_size < 64 || swap_pager_full) && vm_page_count_min()) { | 1155 if ((vm_swap_size < 64 || swap_pager_full) && vm_page_count_min()) { |
1156#endif |
|
1153 mtx_unlock(&vm_mtx); 1154 bigproc = NULL; 1155 bigsize = 0; 1156 sx_slock(&allproc_lock); 1157 mtx_lock(&vm_mtx); 1158 LIST_FOREACH(p, &allproc, p_list) { 1159 /* 1160 * If this process is already locked, skip it. --- 18 unchanged lines hidden (view full) --- 1179 mtx_unlock_spin(&sched_lock); 1180 PROC_UNLOCK(p); 1181 continue; 1182 } 1183 mtx_unlock_spin(&sched_lock); 1184 /* 1185 * get the process size 1186 */ | 1157 mtx_unlock(&vm_mtx); 1158 bigproc = NULL; 1159 bigsize = 0; 1160 sx_slock(&allproc_lock); 1161 mtx_lock(&vm_mtx); 1162 LIST_FOREACH(p, &allproc, p_list) { 1163 /* 1164 * If this process is already locked, skip it. --- 18 unchanged lines hidden (view full) --- 1183 mtx_unlock_spin(&sched_lock); 1184 PROC_UNLOCK(p); 1185 continue; 1186 } 1187 mtx_unlock_spin(&sched_lock); 1188 /* 1189 * get the process size 1190 */ |
1187 size = vmspace_resident_count(p->p_vmspace); | 1191 size = vmspace_resident_count(p->p_vmspace) + 1192 vmspace_swap_count(p->p_vmspace); |
1188 /* 1189 * if the this process is bigger than the biggest one 1190 * remember it. 1191 */ 1192 if (size > bigsize) { 1193 if (bigproc != NULL) 1194 PROC_UNLOCK(bigproc); 1195 bigproc = p; --- 378 unchanged lines hidden --- | 1193 /* 1194 * if the this process is bigger than the biggest one 1195 * remember it. 1196 */ 1197 if (size > bigsize) { 1198 if (bigproc != NULL) 1199 PROC_UNLOCK(bigproc); 1200 bigproc = p; --- 378 unchanged lines hidden --- |