[BACK]Return to uvm.h CVS log [TXT][DIR] Up to [local] / sys / uvm

Annotation of sys/uvm/uvm.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: uvm.h,v 1.21 2007/06/18 21:51:15 pedro Exp $  */
        !             2: /*     $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $     */
        !             3:
        !             4: /*
        !             5:  *
        !             6:  * Copyright (c) 1997 Charles D. Cranor and Washington University.
        !             7:  * All rights reserved.
        !             8:  *
        !             9:  * Redistribution and use in source and binary forms, with or without
        !            10:  * modification, are permitted provided that the following conditions
        !            11:  * are met:
        !            12:  * 1. Redistributions of source code must retain the above copyright
        !            13:  *    notice, this list of conditions and the following disclaimer.
        !            14:  * 2. Redistributions in binary form must reproduce the above copyright
        !            15:  *    notice, this list of conditions and the following disclaimer in the
        !            16:  *    documentation and/or other materials provided with the distribution.
        !            17:  * 3. All advertising materials mentioning features or use of this software
        !            18:  *    must display the following acknowledgement:
        !            19:  *      This product includes software developed by Charles D. Cranor and
        !            20:  *      Washington University.
        !            21:  * 4. The name of the author may not be used to endorse or promote products
        !            22:  *    derived from this software without specific prior written permission.
        !            23:  *
        !            24:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            25:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            26:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            27:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            28:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            29:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            30:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            31:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            32:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            33:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            34:  *
        !            35:  * from: Id: uvm.h,v 1.1.2.14 1998/02/02 20:07:19 chuck Exp
        !            36:  */
        !            37:
        !            38: #ifndef _UVM_UVM_H_
        !            39: #define _UVM_UVM_H_
        !            40:
        !            41: #include <uvm/uvm_extern.h>
        !            42:
        !            43: #include <uvm/uvm_stat.h>
        !            44:
        !            45: /*
        !            46:  * pull in prototypes
        !            47:  */
        !            48:
        !            49: #include <uvm/uvm_amap.h>
        !            50: #include <uvm/uvm_aobj.h>
        !            51: #include <uvm/uvm_fault.h>
        !            52: #include <uvm/uvm_glue.h>
        !            53: #include <uvm/uvm_km.h>
        !            54: #include <uvm/uvm_loan.h>
        !            55: #include <uvm/uvm_map.h>
        !            56: #include <uvm/uvm_object.h>
        !            57: #include <uvm/uvm_page.h>
        !            58: #include <uvm/uvm_pager.h>
        !            59: #include <uvm/uvm_pdaemon.h>
        !            60: #include <uvm/uvm_swap.h>
        !            61: #ifdef UVM_SWAP_ENCRYPT
        !            62: #include <uvm/uvm_swap_encrypt.h>
        !            63: #endif
        !            64:
        !            65: /*
        !            66:  * pull in VM_NFREELIST
        !            67:  */
        !            68: #include <machine/vmparam.h>
        !            69:
        !            70: /*
        !            71:  * uvm structure (vm global state: collected in one structure for ease
        !            72:  * of reference...)
        !            73:  */
        !            74:
        !            75: struct uvm {
        !            76:        /* vm_page related parameters */
        !            77:
        !            78:                /* vm_page queues */
        !            79:        struct pgfreelist page_free[VM_NFREELIST]; /* unallocated pages */
        !            80:        struct pglist page_active;      /* allocated pages, in use */
        !            81:        struct pglist page_inactive_swp;/* pages inactive (reclaim or free) */
        !            82:        struct pglist page_inactive_obj;/* pages inactive (reclaim or free) */
        !            83:        simple_lock_data_t pageqlock;   /* lock for active/inactive page q */
        !            84:        simple_lock_data_t fpageqlock;  /* lock for free page q */
        !            85:        boolean_t page_init_done;       /* TRUE if uvm_page_init() finished */
        !            86:        boolean_t page_idle_zero;       /* TRUE if we should try to zero
        !            87:                                           pages in the idle loop */
        !            88:
        !            89:                /* page daemon trigger */
        !            90:        int pagedaemon;                 /* daemon sleeps on this */
        !            91:        struct proc *pagedaemon_proc;   /* daemon's pid */
        !            92:        simple_lock_data_t pagedaemon_lock;
        !            93:
        !            94:                /* aiodone daemon trigger */
        !            95:        int aiodoned;                   /* daemon sleeps on this */
        !            96:        struct proc *aiodoned_proc;     /* daemon's pid */
        !            97:        simple_lock_data_t aiodoned_lock;
        !            98:
        !            99:                /* page hash */
        !           100:        struct pglist *page_hash;       /* page hash table (vp/off->page) */
        !           101:        int page_nhash;                 /* number of buckets */
        !           102:        int page_hashmask;              /* hash mask */
        !           103:        simple_lock_data_t hashlock;    /* lock on page_hash array */
        !           104:
        !           105:        /* static kernel map entry pool */
        !           106:        vm_map_entry_t kentry_free;     /* free page pool */
        !           107:        simple_lock_data_t kentry_lock;
        !           108:
        !           109:        /* aio_done is locked by uvm.pagedaemon_lock and splbio! */
        !           110:        TAILQ_HEAD(, buf) aio_done;             /* done async i/o reqs */
        !           111:
        !           112:        /* pager VM area bounds */
        !           113:        vaddr_t pager_sva;              /* start of pager VA area */
        !           114:        vaddr_t pager_eva;              /* end of pager VA area */
        !           115:
        !           116:        /* swap-related items */
        !           117:        simple_lock_data_t swap_data_lock;
        !           118:
        !           119:        /* kernel object: to support anonymous pageable kernel memory */
        !           120:        struct uvm_object *kernel_object;
        !           121: };
        !           122:
        !           123: /*
        !           124:  * vm_map_entry etype bits:
        !           125:  */
        !           126:
        !           127: #define UVM_ET_OBJ             0x01    /* it is a uvm_object */
        !           128: #define UVM_ET_SUBMAP          0x02    /* it is a vm_map submap */
        !           129: #define UVM_ET_COPYONWRITE     0x04    /* copy_on_write */
        !           130: #define UVM_ET_NEEDSCOPY       0x08    /* needs_copy */
        !           131:
        !           132: #define UVM_ET_ISOBJ(E)                (((E)->etype & UVM_ET_OBJ) != 0)
        !           133: #define UVM_ET_ISSUBMAP(E)     (((E)->etype & UVM_ET_SUBMAP) != 0)
        !           134: #define UVM_ET_ISCOPYONWRITE(E)        (((E)->etype & UVM_ET_COPYONWRITE) != 0)
        !           135: #define UVM_ET_ISNEEDSCOPY(E)  (((E)->etype & UVM_ET_NEEDSCOPY) != 0)
        !           136:
        !           137: #ifdef _KERNEL
        !           138:
        !           139: /*
        !           140:  * holds all the internal UVM data
        !           141:  */
        !           142: extern struct uvm uvm;
        !           143:
        !           144: /*
        !           145:  * historys
        !           146:  */
        !           147: #ifdef UVMHIST
        !           148: extern UVMHIST_DECL(maphist);
        !           149: extern UVMHIST_DECL(pdhist);
        !           150: extern UVMHIST_DECL(pghist);
        !           151: #endif
        !           152:
        !           153: /*
        !           154:  * UVM_UNLOCK_AND_WAIT: atomic unlock+wait... wrapper around the
        !           155:  * interlocked tsleep() function.
        !           156:  */
        !           157:
        !           158: #define        UVM_UNLOCK_AND_WAIT(event, slock, intr, msg, timo)              \
        !           159: do {                                                                   \
        !           160:        (void) ltsleep(event, PVM | PNORELOCK | (intr ? PCATCH : 0),    \
        !           161:            msg, timo, slock);                                          \
        !           162: } while (0)
        !           163:
        !           164: /*
        !           165:  * UVM_PAGE_OWN: track page ownership (only if UVM_PAGE_TRKOWN)
        !           166:  */
        !           167:
        !           168: #if defined(UVM_PAGE_TRKOWN)
        !           169: #define UVM_PAGE_OWN(PG, TAG) uvm_page_own(PG, TAG)
        !           170: #else
        !           171: #define UVM_PAGE_OWN(PG, TAG) /* nothing */
        !           172: #endif /* UVM_PAGE_TRKOWN */
        !           173:
        !           174: /*
        !           175:  * pull in inlines
        !           176:  */
        !           177:
        !           178: #include <uvm/uvm_amap_i.h>
        !           179: #include <uvm/uvm_fault_i.h>
        !           180: #include <uvm/uvm_map_i.h>
        !           181: #include <uvm/uvm_page_i.h>
        !           182: #include <uvm/uvm_pager_i.h>
        !           183:
        !           184: #endif /* _KERNEL */
        !           185:
        !           186: #endif /* _UVM_UVM_H_ */

CVSweb