Print this page
remove whole-process swapping
Long before Unix supported paging, it used process swapping to reclaim
memory.  The code is there and in theory it runs when we get *extremely* low
on memory.  In practice, it never runs since the definition of low-on-memory
is antiquated. (XXX: define what antiquated means)
You can check the number of swapout/swapin events with kstats:
$ kstat -p ::vm:swapin ::vm:swapout

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4/os/trap.c
          +++ new/usr/src/uts/sun4/os/trap.c
↓ open down ↓ 160 lines elided ↑ open up ↑
 161  161          int watchcode;
 162  162          int watchpage;
 163  163          extern faultcode_t pagefault(caddr_t, enum fault_type,
 164  164              enum seg_rw, int);
 165  165  #ifdef sun4v
 166  166          extern boolean_t tick_stick_emulation_active;
 167  167  #endif  /* sun4v */
 168  168  
 169  169          CPU_STATS_ADDQ(CPU, sys, trap, 1);
 170  170  
 171      -#ifdef SF_ERRATA_23 /* call causes illegal-insn */
 172      -        ASSERT((curthread->t_schedflag & TS_DONT_SWAP) ||
 173      -            (type == T_UNIMP_INSTR));
 174      -#else
 175      -        ASSERT(curthread->t_schedflag & TS_DONT_SWAP);
 176      -#endif /* SF_ERRATA_23 */
 177      -
 178  171          if (USERMODE(rp->r_tstate) || (type & T_USER)) {
 179  172                  /*
 180  173                   * Set lwp_state before trying to acquire any
 181  174                   * adaptive lock
 182  175                   */
 183  176                  ASSERT(lwp != NULL);
 184  177                  lwp->lwp_state = LWP_SYS;
 185  178                  /*
 186  179                   * Set up the current cred to use during this trap. u_cred
 187  180                   * no longer exists.  t_cred is used instead.
↓ open down ↓ 1176 lines elided ↑ open up ↑
1364 1357          k_siginfo_t siginfo;
1365 1358          uint_t op3, fault = 0;
1366 1359          int mstate;
1367 1360          char *badaddr;
1368 1361          kfpu_t *fp;
1369 1362          struct fpq *pfpq;
1370 1363          uint32_t inst;
1371 1364          utrap_handler_t *utrapp;
1372 1365  
1373 1366          CPU_STATS_ADDQ(CPU, sys, trap, 1);
1374      -
1375      -        ASSERT(curthread->t_schedflag & TS_DONT_SWAP);
1376 1367  
1377 1368          if (USERMODE(rp->r_tstate)) {
1378 1369                  /*
1379 1370                   * Set lwp_state before trying to acquire any
1380 1371                   * adaptive lock
1381 1372                   */
1382 1373                  ASSERT(lwp != NULL);
1383 1374                  lwp->lwp_state = LWP_SYS;
1384 1375                  /*
1385 1376                   * Set up the current cred to use during this trap. u_cred
↓ open down ↓ 580 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX