vm_fault.c (df794f5cafcae1a8e94a54731a89b28e987c2156) | vm_fault.c (be9d4fd6b4c5b38ae1c1b2357dd877a364e3c792) |
---|---|
1/*- 2 * SPDX-License-Identifier: (BSD-4-Clause AND MIT-CMU) 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * Copyright (c) 1994 John S. Dyson 7 * All rights reserved. 8 * Copyright (c) 1994 David Greenman --- 1345 unchanged lines hidden (view full) --- 1354 } 1355 1356 /* 1357 * Default objects have no pager so no exclusive busy exists 1358 * to protect this page in the chain. Skip to the next 1359 * object without dropping the lock to preserve atomicity of 1360 * shadow faults. 1361 */ | 1/*- 2 * SPDX-License-Identifier: (BSD-4-Clause AND MIT-CMU) 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * Copyright (c) 1994 John S. Dyson 7 * All rights reserved. 8 * Copyright (c) 1994 David Greenman --- 1345 unchanged lines hidden (view full) --- 1354 } 1355 1356 /* 1357 * Default objects have no pager so no exclusive busy exists 1358 * to protect this page in the chain. Skip to the next 1359 * object without dropping the lock to preserve atomicity of 1360 * shadow faults. 1361 */ |
1362 if (fs.object->type == OBJT_DEFAULT) { 1363 if (vm_fault_next(&fs)) 1364 continue; 1365 /* Don't try to prefault neighboring pages. */ 1366 faultcount = 1; 1367 break; 1368 } | 1362 if (fs.object->type != OBJT_DEFAULT) { 1363 /* 1364 * At this point, we have either allocated a new page 1365 * or found an existing page that is only partially 1366 * valid. 1367 * 1368 * We hold a reference on the current object and the 1369 * page is exclusive busied. The exclusive busy 1370 * prevents simultaneous faults and collapses while 1371 * the object lock is dropped. 1372 */ 1373 VM_OBJECT_WUNLOCK(fs.object); |
1369 | 1374 |
1370 /* 1371 * At this point, we have either allocated a new page or found 1372 * an existing page that is only partially valid. 1373 * 1374 * We hold a reference on the current object and the page is 1375 * exclusive busied. The exclusive busy prevents simultaneous 1376 * faults and collapses while the object lock is dropped. 1377 */ 1378 VM_OBJECT_WUNLOCK(fs.object); | 1375 /* 1376 * If the pager for the current object might have 1377 * the page, then determine the number of additional 1378 * pages to read and potentially reprioritize 1379 * previously read pages for earlier reclamation. 1380 * These operations should only be performed once per 1381 * page fault. Even if the current pager doesn't 1382 * have the page, the number of additional pages to 1383 * read will apply to subsequent objects in the 1384 * shadow chain. 1385 */ 1386 if (nera == -1 && !P_KILLED(curproc)) 1387 nera = vm_fault_readahead(&fs); |
1379 | 1388 |
1380 /* 1381 * If the pager for the current object might have the page, 1382 * then determine the number of additional pages to read and 1383 * potentially reprioritize previously read pages for earlier 1384 * reclamation. These operations should only be performed 1385 * once per page fault. Even if the current pager doesn't 1386 * have the page, the number of additional pages to read will 1387 * apply to subsequent objects in the shadow chain. 1388 */ 1389 if (nera == -1 && !P_KILLED(curproc)) 1390 nera = vm_fault_readahead(&fs); 1391 1392 rv = vm_fault_getpages(&fs, nera, &behind, &ahead); 1393 if (rv == KERN_SUCCESS) { 1394 faultcount = behind + 1 + ahead; 1395 hardfault = true; 1396 break; /* break to PAGE HAS BEEN FOUND. */ | 1389 rv = vm_fault_getpages(&fs, nera, &behind, &ahead); 1390 if (rv == KERN_SUCCESS) { 1391 faultcount = behind + 1 + ahead; 1392 hardfault = true; 1393 break; /* break to PAGE HAS BEEN FOUND. */ 1394 } 1395 if (rv == KERN_RESOURCE_SHORTAGE) 1396 goto RetryFault; 1397 VM_OBJECT_WLOCK(fs.object); 1398 if (rv == KERN_OUT_OF_BOUNDS) { 1399 fault_page_free(&fs.m); 1400 unlock_and_deallocate(&fs); 1401 return (rv); 1402 } |
1397 } | 1403 } |
1398 if (rv == KERN_RESOURCE_SHORTAGE) 1399 goto RetryFault; 1400 VM_OBJECT_WLOCK(fs.object); 1401 if (rv == KERN_OUT_OF_BOUNDS) { 1402 fault_page_free(&fs.m); 1403 unlock_and_deallocate(&fs); 1404 return (rv); 1405 } | |
1406 1407 /* 1408 * The page was not found in the current object. Try to 1409 * traverse into a backing object or zero fill if none is 1410 * found. 1411 */ 1412 if (!vm_fault_next(&fs)) { 1413 /* Don't try to prefault neighboring pages. */ --- 596 unchanged lines hidden --- | 1404 1405 /* 1406 * The page was not found in the current object. Try to 1407 * traverse into a backing object or zero fill if none is 1408 * found. 1409 */ 1410 if (!vm_fault_next(&fs)) { 1411 /* Don't try to prefault neighboring pages. */ --- 596 unchanged lines hidden --- |