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


  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  27 /* All Rights Reserved */
  28 
  29 /*
  30  * Portions of this source code were derived from Berkeley 4.3 BSD
  31  * under license from the Regents of the University of California.
  32  */
  33 
  34 #pragma ident   "%Z%%M% %I%     %E% SMI"
  35 
  36 /*
  37  * VM - segment for non-faulting loads.
  38  */
  39 
  40 #include <sys/types.h>
  41 #include <sys/t_lock.h>
  42 #include <sys/param.h>
  43 #include <sys/mman.h>
  44 #include <sys/errno.h>
  45 #include <sys/kmem.h>
  46 #include <sys/cmn_err.h>
  47 #include <sys/vnode.h>
  48 #include <sys/proc.h>
  49 #include <sys/conf.h>
  50 #include <sys/debug.h>
  51 #include <sys/archsystm.h>
  52 #include <sys/lgrp.h>
  53 
  54 #include <vm/page.h>
  55 #include <vm/hat.h>


  80                     struct page ***ppp, enum lock_type type, enum seg_rw rw);
  81 static int      segnf_setpagesize(struct seg *seg, caddr_t addr, size_t len,
  82                     uint_t szc);
  83 static int      segnf_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);
  84 static lgrp_mem_policy_info_t   *segnf_getpolicy(struct seg *seg,
  85     caddr_t addr);
  86 
  87 
  88 struct seg_ops segnf_ops = {
  89         segnf_dup,
  90         segnf_unmap,
  91         segnf_free,
  92         (faultcode_t (*)(struct hat *, struct seg *, caddr_t, size_t,
  93             enum fault_type, enum seg_rw))
  94                 segnf_nomap,            /* fault */
  95         (faultcode_t (*)(struct seg *, caddr_t))
  96                 segnf_nomap,            /* faulta */
  97         segnf_setprot,
  98         segnf_checkprot,
  99         (int (*)())segnf_badop,         /* kluster */
 100         (size_t (*)(struct seg *))NULL, /* swapout */
 101         (int (*)(struct seg *, caddr_t, size_t, int, uint_t))
 102                 segnf_nop,              /* sync */
 103         (size_t (*)(struct seg *, caddr_t, size_t, char *))
 104                 segnf_nop,              /* incore */
 105         (int (*)(struct seg *, caddr_t, size_t, int, int, ulong_t *, size_t))
 106                 segnf_nop,              /* lockop */
 107         segnf_getprot,
 108         segnf_getoffset,
 109         segnf_gettype,
 110         segnf_getvp,
 111         (int (*)(struct seg *, caddr_t, size_t, uint_t))
 112                 segnf_nop,              /* advise */
 113         segnf_dump,
 114         segnf_pagelock,
 115         segnf_setpagesize,
 116         segnf_getmemid,
 117         segnf_getpolicy,
 118 };
 119 
 120 /*




  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  27 /* All Rights Reserved */
  28 
  29 /*
  30  * Portions of this source code were derived from Berkeley 4.3 BSD
  31  * under license from the Regents of the University of California.
  32  */
  33 


  34 /*
  35  * VM - segment for non-faulting loads.
  36  */
  37 
  38 #include <sys/types.h>
  39 #include <sys/t_lock.h>
  40 #include <sys/param.h>
  41 #include <sys/mman.h>
  42 #include <sys/errno.h>
  43 #include <sys/kmem.h>
  44 #include <sys/cmn_err.h>
  45 #include <sys/vnode.h>
  46 #include <sys/proc.h>
  47 #include <sys/conf.h>
  48 #include <sys/debug.h>
  49 #include <sys/archsystm.h>
  50 #include <sys/lgrp.h>
  51 
  52 #include <vm/page.h>
  53 #include <vm/hat.h>


  78                     struct page ***ppp, enum lock_type type, enum seg_rw rw);
  79 static int      segnf_setpagesize(struct seg *seg, caddr_t addr, size_t len,
  80                     uint_t szc);
  81 static int      segnf_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);
  82 static lgrp_mem_policy_info_t   *segnf_getpolicy(struct seg *seg,
  83     caddr_t addr);
  84 
  85 
  86 struct seg_ops segnf_ops = {
  87         segnf_dup,
  88         segnf_unmap,
  89         segnf_free,
  90         (faultcode_t (*)(struct hat *, struct seg *, caddr_t, size_t,
  91             enum fault_type, enum seg_rw))
  92                 segnf_nomap,            /* fault */
  93         (faultcode_t (*)(struct seg *, caddr_t))
  94                 segnf_nomap,            /* faulta */
  95         segnf_setprot,
  96         segnf_checkprot,
  97         (int (*)())segnf_badop,         /* kluster */

  98         (int (*)(struct seg *, caddr_t, size_t, int, uint_t))
  99                 segnf_nop,              /* sync */
 100         (size_t (*)(struct seg *, caddr_t, size_t, char *))
 101                 segnf_nop,              /* incore */
 102         (int (*)(struct seg *, caddr_t, size_t, int, int, ulong_t *, size_t))
 103                 segnf_nop,              /* lockop */
 104         segnf_getprot,
 105         segnf_getoffset,
 106         segnf_gettype,
 107         segnf_getvp,
 108         (int (*)(struct seg *, caddr_t, size_t, uint_t))
 109                 segnf_nop,              /* advise */
 110         segnf_dump,
 111         segnf_pagelock,
 112         segnf_setpagesize,
 113         segnf_getmemid,
 114         segnf_getpolicy,
 115 };
 116 
 117 /*