Print this page
patch vm-cleanup
@@ -1122,92 +1122,10 @@
ASSERT(old != kas.a_hat);
return (0);
}
/*
- * Allocate any hat resources required for a process being swapped in.
- */
-/*ARGSUSED*/
-void
-hat_swapin(hat_t *hat)
-{
- /* do nothing - we let everything fault back in */
-}
-
-/*
- * Unload all translations associated with an address space of a process
- * that is being swapped out.
- */
-void
-hat_swapout(hat_t *hat)
-{
- uintptr_t vaddr = (uintptr_t)0;
- uintptr_t eaddr = _userlimit;
- htable_t *ht = NULL;
- level_t l;
-
- XPV_DISALLOW_MIGRATE();
- /*
- * We can't just call hat_unload(hat, 0, _userlimit...) here, because
- * seg_spt and shared pagetables can't be swapped out.
- * Take a look at segspt_shmswapout() - it's a big no-op.
- *
- * Instead we'll walk through all the address space and unload
- * any mappings which we are sure are not shared, not locked.
- */
- ASSERT(IS_PAGEALIGNED(vaddr));
- ASSERT(IS_PAGEALIGNED(eaddr));
- ASSERT(AS_LOCK_HELD(hat->hat_as, &hat->hat_as->a_lock));
- if ((uintptr_t)hat->hat_as->a_userlimit < eaddr)
- eaddr = (uintptr_t)hat->hat_as->a_userlimit;
-
- while (vaddr < eaddr) {
- (void) htable_walk(hat, &ht, &vaddr, eaddr);
- if (ht == NULL)
- break;
-
- ASSERT(!IN_VA_HOLE(vaddr));
-
- /*
- * If the page table is shared skip its entire range.
- */
- l = ht->ht_level;
- if (ht->ht_flags & HTABLE_SHARED_PFN) {
- vaddr = ht->ht_vaddr + LEVEL_SIZE(l + 1);
- htable_release(ht);
- ht = NULL;
- continue;
- }
-
- /*
- * If the page table has no locked entries, unload this one.
- */
- if (ht->ht_lock_cnt == 0)
- hat_unload(hat, (caddr_t)vaddr, LEVEL_SIZE(l),
- HAT_UNLOAD_UNMAP);
-
- /*
- * If we have a level 0 page table with locked entries,
- * skip the entire page table, otherwise skip just one entry.
- */
- if (ht->ht_lock_cnt > 0 && l == 0)
- vaddr = ht->ht_vaddr + LEVEL_SIZE(1);
- else
- vaddr += LEVEL_SIZE(l);
- }
- if (ht)
- htable_release(ht);
-
- /*
- * We're in swapout because the system is low on memory, so
- * go back and flush all the htables off the cached list.
- */
- htable_purge_hat(hat);
- XPV_ALLOW_MIGRATE();
-}
-
-/*
* returns number of bytes that have valid mappings in hat.
*/
size_t
hat_get_mapped_size(hat_t *hat)
{