Print this page
patch sccs-keywords
patch SEGOP_SWAPOUT-delete


  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 
  39 #ifndef _VM_SEG_H
  40 #define _VM_SEG_H
  41 
  42 #pragma ident   "%Z%%M% %I%     %E% SMI"
  43 
  44 #include <sys/vnode.h>
  45 #include <sys/avl.h>
  46 #include <vm/seg_enum.h>
  47 #include <vm/faultcode.h>
  48 #include <vm/hat.h>
  49 
  50 #ifdef  __cplusplus
  51 extern "C" {
  52 #endif
  53 
  54 /*
  55  * VM - Segments.
  56  */
  57 
  58 struct anon_map;
  59 
  60 /*
  61  * kstat statistics for segment advise
  62  */
  63 typedef struct {


 108         struct  as *s_as;               /* containing address space */
 109         avl_node_t s_tree;              /* AVL tree links to segs in this as */
 110         struct  seg_ops *s_ops;         /* ops vector: see below */
 111         void *s_data;                   /* private data for instance */
 112         kmutex_t s_pmtx;                /* protects seg's pcache list */
 113         pcache_link_t s_phead;          /* head of seg's pcache list */
 114 } seg_t;
 115 
 116 #define S_PURGE         (0x01)          /* seg should be purged in as_gap() */
 117 
 118 struct  seg_ops {
 119         int     (*dup)(struct seg *, struct seg *);
 120         int     (*unmap)(struct seg *, caddr_t, size_t);
 121         void    (*free)(struct seg *);
 122         faultcode_t (*fault)(struct hat *, struct seg *, caddr_t, size_t,
 123             enum fault_type, enum seg_rw);
 124         faultcode_t (*faulta)(struct seg *, caddr_t);
 125         int     (*setprot)(struct seg *, caddr_t, size_t, uint_t);
 126         int     (*checkprot)(struct seg *, caddr_t, size_t, uint_t);
 127         int     (*kluster)(struct seg *, caddr_t, ssize_t);
 128         size_t  (*swapout)(struct seg *);
 129         int     (*sync)(struct seg *, caddr_t, size_t, int, uint_t);
 130         size_t  (*incore)(struct seg *, caddr_t, size_t, char *);
 131         int     (*lockop)(struct seg *, caddr_t, size_t, int, int, ulong_t *,
 132                         size_t);
 133         int     (*getprot)(struct seg *, caddr_t, size_t, uint_t *);
 134         u_offset_t      (*getoffset)(struct seg *, caddr_t);
 135         int     (*gettype)(struct seg *, caddr_t);
 136         int     (*getvp)(struct seg *, caddr_t, struct vnode **);
 137         int     (*advise)(struct seg *, caddr_t, size_t, uint_t);
 138         void    (*dump)(struct seg *);
 139         int     (*pagelock)(struct seg *, caddr_t, size_t, struct page ***,
 140                         enum lock_type, enum seg_rw);
 141         int     (*setpagesize)(struct seg *, caddr_t, size_t, uint_t);
 142         int     (*getmemid)(struct seg *, caddr_t, memid_t *);
 143         struct lgrp_mem_policy_info     *(*getpolicy)(struct seg *, caddr_t);
 144         int     (*capable)(struct seg *, segcapability_t);
 145 };
 146 
 147 #ifdef _KERNEL
 148 


 202 #define SEGP_FAIL               1       /* seg_pinsert() failed */
 203 
 204 /* Page status bits for segop_incore */
 205 #define SEG_PAGE_INCORE         0x01    /* VA has a page backing it */
 206 #define SEG_PAGE_LOCKED         0x02    /* VA has a page that is locked */
 207 #define SEG_PAGE_HASCOW         0x04    /* VA has a page with a copy-on-write */
 208 #define SEG_PAGE_SOFTLOCK       0x08    /* VA has a page with softlock held */
 209 #define SEG_PAGE_VNODEBACKED    0x10    /* Segment is backed by a vnode */
 210 #define SEG_PAGE_ANON           0x20    /* VA has an anonymous page */
 211 #define SEG_PAGE_VNODE          0x40    /* VA has a vnode page backing it */
 212 
 213 #define SEGOP_DUP(s, n)             (*(s)->s_ops->dup)((s), (n))
 214 #define SEGOP_UNMAP(s, a, l)        (*(s)->s_ops->unmap)((s), (a), (l))
 215 #define SEGOP_FREE(s)               (*(s)->s_ops->free)((s))
 216 #define SEGOP_FAULT(h, s, a, l, t, rw) \
 217                 (*(s)->s_ops->fault)((h), (s), (a), (l), (t), (rw))
 218 #define SEGOP_FAULTA(s, a)          (*(s)->s_ops->faulta)((s), (a))
 219 #define SEGOP_SETPROT(s, a, l, p)   (*(s)->s_ops->setprot)((s), (a), (l), (p))
 220 #define SEGOP_CHECKPROT(s, a, l, p) (*(s)->s_ops->checkprot)((s), (a), (l), (p))
 221 #define SEGOP_KLUSTER(s, a, d)      (*(s)->s_ops->kluster)((s), (a), (d))
 222 #define SEGOP_SWAPOUT(s)            (*(s)->s_ops->swapout)((s))
 223 #define SEGOP_SYNC(s, a, l, atr, f) \
 224                 (*(s)->s_ops->sync)((s), (a), (l), (atr), (f))
 225 #define SEGOP_INCORE(s, a, l, v)    (*(s)->s_ops->incore)((s), (a), (l), (v))
 226 #define SEGOP_LOCKOP(s, a, l, atr, op, b, p) \
 227                 (*(s)->s_ops->lockop)((s), (a), (l), (atr), (op), (b), (p))
 228 #define SEGOP_GETPROT(s, a, l, p)   (*(s)->s_ops->getprot)((s), (a), (l), (p))
 229 #define SEGOP_GETOFFSET(s, a)       (*(s)->s_ops->getoffset)((s), (a))
 230 #define SEGOP_GETTYPE(s, a)         (*(s)->s_ops->gettype)((s), (a))
 231 #define SEGOP_GETVP(s, a, vpp)      (*(s)->s_ops->getvp)((s), (a), (vpp))
 232 #define SEGOP_ADVISE(s, a, l, b)    (*(s)->s_ops->advise)((s), (a), (l), (b))
 233 #define SEGOP_DUMP(s)               (*(s)->s_ops->dump)((s))
 234 #define SEGOP_PAGELOCK(s, a, l, p, t, rw) \
 235                 (*(s)->s_ops->pagelock)((s), (a), (l), (p), (t), (rw))
 236 #define SEGOP_SETPAGESIZE(s, a, l, szc) \
 237                 (*(s)->s_ops->setpagesize)((s), (a), (l), (szc))
 238 #define SEGOP_GETMEMID(s, a, mp)    (*(s)->s_ops->getmemid)((s), (a), (mp))
 239 #define SEGOP_GETPOLICY(s, a)       (*(s)->s_ops->getpolicy)((s), (a))
 240 #define SEGOP_CAPABLE(s, c)         (*(s)->s_ops->capable)((s), (c))
 241 
 242 #define seg_page(seg, addr) \




  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 
  39 #ifndef _VM_SEG_H
  40 #define _VM_SEG_H
  41 


  42 #include <sys/vnode.h>
  43 #include <sys/avl.h>
  44 #include <vm/seg_enum.h>
  45 #include <vm/faultcode.h>
  46 #include <vm/hat.h>
  47 
  48 #ifdef  __cplusplus
  49 extern "C" {
  50 #endif
  51 
  52 /*
  53  * VM - Segments.
  54  */
  55 
  56 struct anon_map;
  57 
  58 /*
  59  * kstat statistics for segment advise
  60  */
  61 typedef struct {


 106         struct  as *s_as;               /* containing address space */
 107         avl_node_t s_tree;              /* AVL tree links to segs in this as */
 108         struct  seg_ops *s_ops;         /* ops vector: see below */
 109         void *s_data;                   /* private data for instance */
 110         kmutex_t s_pmtx;                /* protects seg's pcache list */
 111         pcache_link_t s_phead;          /* head of seg's pcache list */
 112 } seg_t;
 113 
 114 #define S_PURGE         (0x01)          /* seg should be purged in as_gap() */
 115 
 116 struct  seg_ops {
 117         int     (*dup)(struct seg *, struct seg *);
 118         int     (*unmap)(struct seg *, caddr_t, size_t);
 119         void    (*free)(struct seg *);
 120         faultcode_t (*fault)(struct hat *, struct seg *, caddr_t, size_t,
 121             enum fault_type, enum seg_rw);
 122         faultcode_t (*faulta)(struct seg *, caddr_t);
 123         int     (*setprot)(struct seg *, caddr_t, size_t, uint_t);
 124         int     (*checkprot)(struct seg *, caddr_t, size_t, uint_t);
 125         int     (*kluster)(struct seg *, caddr_t, ssize_t);

 126         int     (*sync)(struct seg *, caddr_t, size_t, int, uint_t);
 127         size_t  (*incore)(struct seg *, caddr_t, size_t, char *);
 128         int     (*lockop)(struct seg *, caddr_t, size_t, int, int, ulong_t *,
 129                         size_t);
 130         int     (*getprot)(struct seg *, caddr_t, size_t, uint_t *);
 131         u_offset_t      (*getoffset)(struct seg *, caddr_t);
 132         int     (*gettype)(struct seg *, caddr_t);
 133         int     (*getvp)(struct seg *, caddr_t, struct vnode **);
 134         int     (*advise)(struct seg *, caddr_t, size_t, uint_t);
 135         void    (*dump)(struct seg *);
 136         int     (*pagelock)(struct seg *, caddr_t, size_t, struct page ***,
 137                         enum lock_type, enum seg_rw);
 138         int     (*setpagesize)(struct seg *, caddr_t, size_t, uint_t);
 139         int     (*getmemid)(struct seg *, caddr_t, memid_t *);
 140         struct lgrp_mem_policy_info     *(*getpolicy)(struct seg *, caddr_t);
 141         int     (*capable)(struct seg *, segcapability_t);
 142 };
 143 
 144 #ifdef _KERNEL
 145 


 199 #define SEGP_FAIL               1       /* seg_pinsert() failed */
 200 
 201 /* Page status bits for segop_incore */
 202 #define SEG_PAGE_INCORE         0x01    /* VA has a page backing it */
 203 #define SEG_PAGE_LOCKED         0x02    /* VA has a page that is locked */
 204 #define SEG_PAGE_HASCOW         0x04    /* VA has a page with a copy-on-write */
 205 #define SEG_PAGE_SOFTLOCK       0x08    /* VA has a page with softlock held */
 206 #define SEG_PAGE_VNODEBACKED    0x10    /* Segment is backed by a vnode */
 207 #define SEG_PAGE_ANON           0x20    /* VA has an anonymous page */
 208 #define SEG_PAGE_VNODE          0x40    /* VA has a vnode page backing it */
 209 
 210 #define SEGOP_DUP(s, n)             (*(s)->s_ops->dup)((s), (n))
 211 #define SEGOP_UNMAP(s, a, l)        (*(s)->s_ops->unmap)((s), (a), (l))
 212 #define SEGOP_FREE(s)               (*(s)->s_ops->free)((s))
 213 #define SEGOP_FAULT(h, s, a, l, t, rw) \
 214                 (*(s)->s_ops->fault)((h), (s), (a), (l), (t), (rw))
 215 #define SEGOP_FAULTA(s, a)          (*(s)->s_ops->faulta)((s), (a))
 216 #define SEGOP_SETPROT(s, a, l, p)   (*(s)->s_ops->setprot)((s), (a), (l), (p))
 217 #define SEGOP_CHECKPROT(s, a, l, p) (*(s)->s_ops->checkprot)((s), (a), (l), (p))
 218 #define SEGOP_KLUSTER(s, a, d)      (*(s)->s_ops->kluster)((s), (a), (d))

 219 #define SEGOP_SYNC(s, a, l, atr, f) \
 220                 (*(s)->s_ops->sync)((s), (a), (l), (atr), (f))
 221 #define SEGOP_INCORE(s, a, l, v)    (*(s)->s_ops->incore)((s), (a), (l), (v))
 222 #define SEGOP_LOCKOP(s, a, l, atr, op, b, p) \
 223                 (*(s)->s_ops->lockop)((s), (a), (l), (atr), (op), (b), (p))
 224 #define SEGOP_GETPROT(s, a, l, p)   (*(s)->s_ops->getprot)((s), (a), (l), (p))
 225 #define SEGOP_GETOFFSET(s, a)       (*(s)->s_ops->getoffset)((s), (a))
 226 #define SEGOP_GETTYPE(s, a)         (*(s)->s_ops->gettype)((s), (a))
 227 #define SEGOP_GETVP(s, a, vpp)      (*(s)->s_ops->getvp)((s), (a), (vpp))
 228 #define SEGOP_ADVISE(s, a, l, b)    (*(s)->s_ops->advise)((s), (a), (l), (b))
 229 #define SEGOP_DUMP(s)               (*(s)->s_ops->dump)((s))
 230 #define SEGOP_PAGELOCK(s, a, l, p, t, rw) \
 231                 (*(s)->s_ops->pagelock)((s), (a), (l), (p), (t), (rw))
 232 #define SEGOP_SETPAGESIZE(s, a, l, szc) \
 233                 (*(s)->s_ops->setpagesize)((s), (a), (l), (szc))
 234 #define SEGOP_GETMEMID(s, a, mp)    (*(s)->s_ops->getmemid)((s), (a), (mp))
 235 #define SEGOP_GETPOLICY(s, a)       (*(s)->s_ops->getpolicy)((s), (a))
 236 #define SEGOP_CAPABLE(s, c)         (*(s)->s_ops->capable)((s), (c))
 237 
 238 #define seg_page(seg, addr) \