The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/uvm/uvm_object.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: uvm_object.h,v 1.39 2020/08/14 09:06:15 chs Exp $      */
    2 
    3 /*
    4  * Copyright (c) 1997 Charles D. Cranor and Washington University.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   26  *
   27  * from: Id: uvm_object.h,v 1.1.2.2 1998/01/04 22:44:51 chuck Exp
   28  */
   29 
   30 #ifndef _UVM_UVM_OBJECT_H_
   31 #define _UVM_UVM_OBJECT_H_
   32 
   33 #include <sys/queue.h>
   34 #include <sys/radixtree.h>
   35 #include <uvm/uvm_pglist.h>
   36 
   37 /*
   38  * The UVM memory object interface.  Notes:
   39  *
   40  * A UVM memory object represents a list of pages, which are managed by
   41  * the object's pager operations (uvm_object::pgops).  All pages belonging
   42  * to an object are owned by it and thus protected by the object lock.
   43  *
   44  * The lock (uvm_object::vmobjlock) may be shared amongst the UVM objects.
   45  * By default, the lock is allocated dynamically using mutex_obj(9) cache.
   46  * Lock sharing is normally used when there is an underlying object.  For
   47  * example, vnode representing a file may have an underlying node, which
   48  * is the case for tmpfs and layered file systems.  In such case, vnode's
   49  * UVM object and the underlying UVM object shares the lock (note that the
   50  * vnode_t::v_interlock points to uvm_object::vmobjlock).
   51  *
   52  * The reference count is managed atomically for the anonymous UVM objects.
   53  * For other objects, it is arbitrary (may use the lock or atomics).
   54  */
   55 
   56 struct krwlock;
   57 struct uvm_object {
   58         struct krwlock *        vmobjlock;      /* lock on object */
   59         const struct uvm_pagerops *pgops;       /* pager ops */
   60         int                     uo_npages;      /* # of pages in uo_pages */
   61         unsigned                uo_refs;        /* reference count */
   62         struct radix_tree       uo_pages;       /* tree of pages */
   63         LIST_HEAD(,ubc_map)     uo_ubc;         /* ubc mappings */
   64 };
   65 
   66 /*
   67  * tags for uo_pages
   68  */
   69 
   70 #define UVM_PAGE_DIRTY_TAG      1       /* might be dirty (!PG_CLEAN) */
   71 #define UVM_PAGE_WRITEBACK_TAG  2       /* being written back */
   72 
   73 /*
   74  * UVM_OBJ_KERN is a 'special' uo_refs value which indicates that the
   75  * object is a kernel memory object rather than a normal one (kernel
   76  * memory objects don't have reference counts -- they never die).
   77  *
   78  * this value is used to detected kernel object mappings at uvm_unmap()
   79  * time.   normally when an object is unmapped its pages eventaully become
   80  * deactivated and then paged out and/or freed.    this is not useful
   81  * for kernel objects... when a kernel object is unmapped we always want
   82  * to free the resources associated with the mapping.   UVM_OBJ_KERN
   83  * allows us to decide which type of unmapping we want to do.
   84  */
   85 #define UVM_OBJ_KERN            (-2)
   86 
   87 #define UVM_OBJ_IS_KERN_OBJECT(uobj)                                    \
   88         ((uobj)->uo_refs == UVM_OBJ_KERN)
   89 
   90 #ifdef _KERNEL
   91 
   92 extern const struct uvm_pagerops uvm_vnodeops;
   93 extern const struct uvm_pagerops uvm_deviceops;
   94 extern const struct uvm_pagerops ubc_pager;
   95 extern const struct uvm_pagerops aobj_pager;
   96 
   97 #define UVM_OBJ_IS_VNODE(uobj)                                          \
   98         ((uobj)->pgops == &uvm_vnodeops)
   99 
  100 #define UVM_OBJ_IS_DEVICE(uobj)                                         \
  101         ((uobj)->pgops == &uvm_deviceops)
  102 
  103 #define UVM_OBJ_IS_VTEXT(uobj)                                          \
  104         (UVM_OBJ_IS_VNODE(uobj) && uvn_text_p(uobj))
  105 
  106 #define UVM_OBJ_IS_CLEAN(uobj)                                          \
  107         (UVM_OBJ_IS_VNODE(uobj) && uvm_obj_clean_p(uobj))
  108 
  109 /*
  110  * UVM_OBJ_NEEDS_WRITEFAULT: true if the uobj needs to detect modification.
  111  * (ie. wants to avoid writable user mappings.)
  112  *
  113  * XXX bad name
  114  */
  115 
  116 #define UVM_OBJ_NEEDS_WRITEFAULT(uobj)                                  \
  117         (UVM_OBJ_IS_VNODE(uobj) && uvm_obj_clean_p(uobj))
  118 
  119 #define UVM_OBJ_IS_AOBJ(uobj)                                           \
  120         ((uobj)->pgops == &aobj_pager)
  121 
  122 #endif /* _KERNEL */
  123 
  124 #endif /* _UVM_UVM_OBJECT_H_ */

Cache object: 01cef4255907404d8c8aa7623a7dbfe9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.