Lines 1583-1589
vm_object_backing_scan(vm_object_t object, int op)
Link Here
|
1583 |
continue; |
1583 |
continue; |
1584 |
} |
1584 |
} |
1585 |
|
1585 |
|
1586 |
KASSERT(pp == NULL || pp->valid != 0, |
1586 |
KASSERT(pp == NULL || pp->wire_count > 0 || pp->valid != 0, |
1587 |
("unbusy invalid page %p", pp)); |
1587 |
("unbusy invalid page %p", pp)); |
1588 |
|
1588 |
|
1589 |
if (pp != NULL || vm_pager_has_page(object, |
1589 |
if (pp != NULL || vm_pager_has_page(object, |
Lines 1673-1683
vm_object_qcollapse(vm_object_t object)
Link Here
|
1673 |
void |
1673 |
void |
1674 |
vm_object_collapse(vm_object_t object) |
1674 |
vm_object_collapse(vm_object_t object) |
1675 |
{ |
1675 |
{ |
|
|
1676 |
vm_object_t backing_object, new_backing_object; |
1677 |
|
1676 |
VM_OBJECT_ASSERT_WLOCKED(object); |
1678 |
VM_OBJECT_ASSERT_WLOCKED(object); |
1677 |
|
1679 |
|
|
|
1680 |
if ((object->flags & OBJ_DEAD) != 0) |
1681 |
return; |
1682 |
vm_object_pip_add(object, 1); |
1678 |
while (TRUE) { |
1683 |
while (TRUE) { |
1679 |
vm_object_t backing_object; |
|
|
1680 |
|
1681 |
/* |
1684 |
/* |
1682 |
* Verify that the conditions are right for collapse: |
1685 |
* Verify that the conditions are right for collapse: |
1683 |
* |
1686 |
* |
Lines 1703-1716
vm_object_collapse(vm_object_t object)
Link Here
|
1703 |
break; |
1706 |
break; |
1704 |
} |
1707 |
} |
1705 |
|
1708 |
|
1706 |
if ( |
1709 |
if (object->paging_in_progress > 1 /* one ref is from us */ || |
1707 |
object->paging_in_progress != 0 || |
1710 |
backing_object->paging_in_progress != 0) { |
1708 |
backing_object->paging_in_progress != 0 |
|
|
1709 |
) { |
1710 |
vm_object_qcollapse(object); |
1711 |
vm_object_qcollapse(object); |
1711 |
VM_OBJECT_WUNLOCK(backing_object); |
1712 |
VM_OBJECT_WUNLOCK(backing_object); |
1712 |
break; |
1713 |
break; |
1713 |
} |
1714 |
} |
|
|
1715 |
vm_object_pip_add(backing_object, 1); |
1716 |
|
1714 |
/* |
1717 |
/* |
1715 |
* We know that we can either collapse the backing object (if |
1718 |
* We know that we can either collapse the backing object (if |
1716 |
* the parent is the only reference to it) or (perhaps) have |
1719 |
* the parent is the only reference to it) or (perhaps) have |
Lines 1793-1798
vm_object_collapse(vm_object_t object)
Link Here
|
1793 |
KASSERT(backing_object->ref_count == 1, ( |
1796 |
KASSERT(backing_object->ref_count == 1, ( |
1794 |
"backing_object %p was somehow re-referenced during collapse!", |
1797 |
"backing_object %p was somehow re-referenced during collapse!", |
1795 |
backing_object)); |
1798 |
backing_object)); |
|
|
1799 |
vm_object_pip_wakeup(backing_object); |
1796 |
backing_object->type = OBJT_DEAD; |
1800 |
backing_object->type = OBJT_DEAD; |
1797 |
backing_object->ref_count = 0; |
1801 |
backing_object->ref_count = 0; |
1798 |
VM_OBJECT_WUNLOCK(backing_object); |
1802 |
VM_OBJECT_WUNLOCK(backing_object); |
Lines 1800-1807
vm_object_collapse(vm_object_t object)
Link Here
|
1800 |
|
1804 |
|
1801 |
object_collapses++; |
1805 |
object_collapses++; |
1802 |
} else { |
1806 |
} else { |
1803 |
vm_object_t new_backing_object; |
|
|
1804 |
|
1805 |
/* |
1807 |
/* |
1806 |
* If we do not entirely shadow the backing object, |
1808 |
* If we do not entirely shadow the backing object, |
1807 |
* there is nothing we can do so we give up. |
1809 |
* there is nothing we can do so we give up. |
Lines 1809-1814
vm_object_collapse(vm_object_t object)
Link Here
|
1809 |
if (object->resident_page_count != object->size && |
1811 |
if (object->resident_page_count != object->size && |
1810 |
!vm_object_backing_scan(object, |
1812 |
!vm_object_backing_scan(object, |
1811 |
OBSC_TEST_ALL_SHADOWED)) { |
1813 |
OBSC_TEST_ALL_SHADOWED)) { |
|
|
1814 |
vm_object_pip_wakeup(backing_object); |
1812 |
VM_OBJECT_WUNLOCK(backing_object); |
1815 |
VM_OBJECT_WUNLOCK(backing_object); |
1813 |
break; |
1816 |
break; |
1814 |
} |
1817 |
} |
Lines 1841-1846
vm_object_collapse(vm_object_t object)
Link Here
|
1841 |
* its ref_count was at least 2, it will not vanish. |
1844 |
* its ref_count was at least 2, it will not vanish. |
1842 |
*/ |
1845 |
*/ |
1843 |
backing_object->ref_count--; |
1846 |
backing_object->ref_count--; |
|
|
1847 |
vm_object_pip_wakeup(backing_object); |
1844 |
VM_OBJECT_WUNLOCK(backing_object); |
1848 |
VM_OBJECT_WUNLOCK(backing_object); |
1845 |
object_bypasses++; |
1849 |
object_bypasses++; |
1846 |
} |
1850 |
} |
Lines 1849-1854
vm_object_collapse(vm_object_t object)
Link Here
|
1849 |
* Try again with this object's new backing object. |
1853 |
* Try again with this object's new backing object. |
1850 |
*/ |
1854 |
*/ |
1851 |
} |
1855 |
} |
|
|
1856 |
vm_object_pip_wakeup(object); |
1852 |
} |
1857 |
} |
1853 |
|
1858 |
|
1854 |
/* |
1859 |
/* |