vm_object.c (205be21d997d5becfaee5918386d4087b09f98a8) | vm_object.c (0012f373e43db2341c20329163ed2d5ad3b0f341) |
---|---|
1/*- 2 * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU) 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * The Mach Operating System project at Carnegie-Mellon University. --- 827 unchanged lines hidden (view full) --- 836rescan: 837 curgeneration = object->generation; 838 839 for (p = vm_page_find_least(object, tstart); p != NULL; p = np) { 840 pi = p->pindex; 841 if (pi >= tend) 842 break; 843 np = TAILQ_NEXT(p, listq); | 1/*- 2 * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU) 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * The Mach Operating System project at Carnegie-Mellon University. --- 827 unchanged lines hidden (view full) --- 836rescan: 837 curgeneration = object->generation; 838 839 for (p = vm_page_find_least(object, tstart); p != NULL; p = np) { 840 pi = p->pindex; 841 if (pi >= tend) 842 break; 843 np = TAILQ_NEXT(p, listq); |
844 if (p->valid == 0) | 844 if (vm_page_none_valid(p)) |
845 continue; 846 if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { 847 if (object->generation != curgeneration) { 848 if ((flags & OBJPC_SYNC) != 0) 849 goto rescan; 850 else 851 clearobjflags = FALSE; 852 } --- 303 unchanged lines hidden (view full) --- 1156 NULL); 1157 } else { 1158next_page: 1159 tm = m; 1160 m = TAILQ_NEXT(m, listq); 1161 } 1162 1163 /* | 845 continue; 846 if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) { 847 if (object->generation != curgeneration) { 848 if ((flags & OBJPC_SYNC) != 0) 849 goto rescan; 850 else 851 clearobjflags = FALSE; 852 } --- 303 unchanged lines hidden (view full) --- 1156 NULL); 1157 } else { 1158next_page: 1159 tm = m; 1160 m = TAILQ_NEXT(m, listq); 1161 } 1162 1163 /* |
1164 * If the page is not in a normal state, skip it. | 1164 * If the page is not in a normal state, skip it. The page 1165 * can not be invalidated while the object lock is held. |
1165 */ | 1166 */ |
1166 if (tm->valid != VM_PAGE_BITS_ALL || 1167 vm_page_wired(tm)) | 1167 if (!vm_page_all_valid(tm) || vm_page_wired(tm)) |
1168 goto next_pindex; 1169 KASSERT((tm->flags & PG_FICTITIOUS) == 0, 1170 ("vm_object_madvise: page %p is fictitious", tm)); 1171 KASSERT((tm->oflags & VPO_UNMANAGED) == 0, 1172 ("vm_object_madvise: page %p is not managed", tm)); 1173 if (vm_page_tryxbusy(tm) == 0) { 1174 if (object != tobject) 1175 VM_OBJECT_WUNLOCK(object); --- 307 unchanged lines hidden (view full) --- 1483 * See if the parent has the page or if the parent's object 1484 * pager has the page. If the parent has the page but the page 1485 * is not valid, the parent's object pager must have the page. 1486 * 1487 * If this fails, the parent does not completely shadow the 1488 * object and we might as well give up now. 1489 */ 1490 pp = vm_page_lookup(object, new_pindex); | 1168 goto next_pindex; 1169 KASSERT((tm->flags & PG_FICTITIOUS) == 0, 1170 ("vm_object_madvise: page %p is fictitious", tm)); 1171 KASSERT((tm->oflags & VPO_UNMANAGED) == 0, 1172 ("vm_object_madvise: page %p is not managed", tm)); 1173 if (vm_page_tryxbusy(tm) == 0) { 1174 if (object != tobject) 1175 VM_OBJECT_WUNLOCK(object); --- 307 unchanged lines hidden (view full) --- 1483 * See if the parent has the page or if the parent's object 1484 * pager has the page. If the parent has the page but the page 1485 * is not valid, the parent's object pager must have the page. 1486 * 1487 * If this fails, the parent does not completely shadow the 1488 * object and we might as well give up now. 1489 */ 1490 pp = vm_page_lookup(object, new_pindex); |
1491 if ((pp == NULL || pp->valid == 0) && | 1491 /* 1492 * The valid check here is stable due to object lock being 1493 * required to clear valid and initiate paging. 1494 */ 1495 if ((pp == NULL || vm_page_none_valid(pp)) && |
1492 !vm_pager_has_page(object, new_pindex, NULL, NULL)) 1493 return (false); 1494 } 1495 return (true); 1496} 1497 1498static bool 1499vm_object_collapse_scan(vm_object_t object, int op) --- 62 unchanged lines hidden (view full) --- 1562 * unbusy the original (backing_obj) page before we can 1563 * (re)lock the parent. Hence we can get here. 1564 */ 1565 next = vm_object_collapse_scan_wait(object, pp, next, 1566 op); 1567 continue; 1568 } 1569 | 1496 !vm_pager_has_page(object, new_pindex, NULL, NULL)) 1497 return (false); 1498 } 1499 return (true); 1500} 1501 1502static bool 1503vm_object_collapse_scan(vm_object_t object, int op) --- 62 unchanged lines hidden (view full) --- 1566 * unbusy the original (backing_obj) page before we can 1567 * (re)lock the parent. Hence we can get here. 1568 */ 1569 next = vm_object_collapse_scan_wait(object, pp, next, 1570 op); 1571 continue; 1572 } 1573 |
1570 KASSERT(pp == NULL || pp->valid != 0, | 1574 KASSERT(pp == NULL || !vm_page_none_valid(pp), |
1571 ("unbusy invalid page %p", pp)); 1572 1573 if (pp != NULL || vm_pager_has_page(object, new_pindex, NULL, 1574 NULL)) { 1575 /* 1576 * The page already exists in the parent OR swap exists 1577 * for this location in the parent. Leave the parent's 1578 * page alone. Destroy the original page from the --- 310 unchanged lines hidden (view full) --- 1889 goto again; 1890 } 1891 if (vm_page_wired(p)) { 1892wired: 1893 if ((options & OBJPR_NOTMAPPED) == 0 && 1894 object->ref_count != 0) 1895 pmap_remove_all(p); 1896 if ((options & OBJPR_CLEANONLY) == 0) { | 1575 ("unbusy invalid page %p", pp)); 1576 1577 if (pp != NULL || vm_pager_has_page(object, new_pindex, NULL, 1578 NULL)) { 1579 /* 1580 * The page already exists in the parent OR swap exists 1581 * for this location in the parent. Leave the parent's 1582 * page alone. Destroy the original page from the --- 310 unchanged lines hidden (view full) --- 1893 goto again; 1894 } 1895 if (vm_page_wired(p)) { 1896wired: 1897 if ((options & OBJPR_NOTMAPPED) == 0 && 1898 object->ref_count != 0) 1899 pmap_remove_all(p); 1900 if ((options & OBJPR_CLEANONLY) == 0) { |
1897 p->valid = 0; | 1901 vm_page_invalid(p); |
1898 vm_page_undirty(p); 1899 } 1900 vm_page_xunbusy(p); 1901 continue; 1902 } 1903 KASSERT((p->flags & PG_FICTITIOUS) == 0, 1904 ("vm_object_page_remove: page %p is fictitious", p)); | 1902 vm_page_undirty(p); 1903 } 1904 vm_page_xunbusy(p); 1905 continue; 1906 } 1907 KASSERT((p->flags & PG_FICTITIOUS) == 0, 1908 ("vm_object_page_remove: page %p is fictitious", p)); |
1905 if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) { | 1909 if ((options & OBJPR_CLEANONLY) != 0 && 1910 !vm_page_none_valid(p)) { |
1906 if ((options & OBJPR_NOTMAPPED) == 0 && 1907 object->ref_count != 0 && 1908 !vm_page_try_remove_write(p)) 1909 goto wired; 1910 if (p->dirty != 0) { 1911 vm_page_xunbusy(p); 1912 continue; 1913 } --- 743 unchanged lines hidden --- | 1911 if ((options & OBJPR_NOTMAPPED) == 0 && 1912 object->ref_count != 0 && 1913 !vm_page_try_remove_write(p)) 1914 goto wired; 1915 if (p->dirty != 0) { 1916 vm_page_xunbusy(p); 1917 continue; 1918 } --- 743 unchanged lines hidden --- |