Print this page
6583 remove whole-process swapping

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/vm/hat_i86.c
          +++ new/usr/src/uts/i86pc/vm/hat_i86.c
↓ open down ↓ 1117 lines elided ↑ open up ↑
1118 1118  int
1119 1119  hat_dup(hat_t *old, hat_t *new, caddr_t addr, size_t len, uint_t flag)
1120 1120  {
1121 1121          ASSERT((uintptr_t)addr < kernelbase);
1122 1122          ASSERT(new != kas.a_hat);
1123 1123          ASSERT(old != kas.a_hat);
1124 1124          return (0);
1125 1125  }
1126 1126  
1127 1127  /*
1128      - * Allocate any hat resources required for a process being swapped in.
1129      - */
1130      -/*ARGSUSED*/
1131      -void
1132      -hat_swapin(hat_t *hat)
1133      -{
1134      -        /* do nothing - we let everything fault back in */
1135      -}
1136      -
1137      -/*
1138      - * Unload all translations associated with an address space of a process
1139      - * that is being swapped out.
1140      - */
1141      -void
1142      -hat_swapout(hat_t *hat)
1143      -{
1144      -        uintptr_t       vaddr = (uintptr_t)0;
1145      -        uintptr_t       eaddr = _userlimit;
1146      -        htable_t        *ht = NULL;
1147      -        level_t         l;
1148      -
1149      -        XPV_DISALLOW_MIGRATE();
1150      -        /*
1151      -         * We can't just call hat_unload(hat, 0, _userlimit...)  here, because
1152      -         * seg_spt and shared pagetables can't be swapped out.
1153      -         * Take a look at segspt_shmswapout() - it's a big no-op.
1154      -         *
1155      -         * Instead we'll walk through all the address space and unload
1156      -         * any mappings which we are sure are not shared, not locked.
1157      -         */
1158      -        ASSERT(IS_PAGEALIGNED(vaddr));
1159      -        ASSERT(IS_PAGEALIGNED(eaddr));
1160      -        ASSERT(AS_LOCK_HELD(hat->hat_as));
1161      -        if ((uintptr_t)hat->hat_as->a_userlimit < eaddr)
1162      -                eaddr = (uintptr_t)hat->hat_as->a_userlimit;
1163      -
1164      -        while (vaddr < eaddr) {
1165      -                (void) htable_walk(hat, &ht, &vaddr, eaddr);
1166      -                if (ht == NULL)
1167      -                        break;
1168      -
1169      -                ASSERT(!IN_VA_HOLE(vaddr));
1170      -
1171      -                /*
1172      -                 * If the page table is shared skip its entire range.
1173      -                 */
1174      -                l = ht->ht_level;
1175      -                if (ht->ht_flags & HTABLE_SHARED_PFN) {
1176      -                        vaddr = ht->ht_vaddr + LEVEL_SIZE(l + 1);
1177      -                        htable_release(ht);
1178      -                        ht = NULL;
1179      -                        continue;
1180      -                }
1181      -
1182      -                /*
1183      -                 * If the page table has no locked entries, unload this one.
1184      -                 */
1185      -                if (ht->ht_lock_cnt == 0)
1186      -                        hat_unload(hat, (caddr_t)vaddr, LEVEL_SIZE(l),
1187      -                            HAT_UNLOAD_UNMAP);
1188      -
1189      -                /*
1190      -                 * If we have a level 0 page table with locked entries,
1191      -                 * skip the entire page table, otherwise skip just one entry.
1192      -                 */
1193      -                if (ht->ht_lock_cnt > 0 && l == 0)
1194      -                        vaddr = ht->ht_vaddr + LEVEL_SIZE(1);
1195      -                else
1196      -                        vaddr += LEVEL_SIZE(l);
1197      -        }
1198      -        if (ht)
1199      -                htable_release(ht);
1200      -
1201      -        /*
1202      -         * We're in swapout because the system is low on memory, so
1203      -         * go back and flush all the htables off the cached list.
1204      -         */
1205      -        htable_purge_hat(hat);
1206      -        XPV_ALLOW_MIGRATE();
1207      -}
1208      -
1209      -/*
1210 1128   * returns number of bytes that have valid mappings in hat.
1211 1129   */
1212 1130  size_t
1213 1131  hat_get_mapped_size(hat_t *hat)
1214 1132  {
1215 1133          size_t total = 0;
1216 1134          int l;
1217 1135  
1218 1136          for (l = 0; l <= mmu.max_page_level; l++)
1219 1137                  total += (hat->hat_pages_mapped[l] << LEVEL_SHIFT(l));
↓ open down ↓ 3273 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX