Print this page
code review from Josh and Robert

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man9/vmem.9
          +++ new/usr/src/man/man9/vmem.9
↓ open down ↓ 62 lines elided ↑ open up ↑
  63   63  anything at all.  For example, we could use an arena containing the
  64   64  integers minpid through maxpid to allocate process IDs.  For uses of this
  65   65  nature, prefer
  66   66  .Xr id_space 9F
  67   67  instead.
  68   68  .Pp
  69   69  .Fn vmem_create
  70   70  and
  71   71  .Fn vmem_destroy
  72   72  create and destroy vmem arenas.  In order to differentiate between arenas used
  73      -for adresses and arenas used for identifiers, the
       73 +for addresses and arenas used for identifiers, the
  74   74  .Dv VMC_IDENTIFIER
  75   75  flag is passed to
  76   76  .Fn vmem_create .
  77   77  This prevents identifier exhaustion from being diagnosed as general memory
  78   78  failure.
  79   79  .Ss Spans
  80   80  We represent the integers in an arena as a collection of
  81   81  .Em spans ,
  82   82  or contiguous ranges of integers.  For example, the kernel heap consists of
  83   83  just one span:
  84   84  .Li "[kernelheap, ekernelheap)" .
  85   85  Spans can be added to an arena in two ways: explicitly, by
  86      -.Fn vmem_add ,
       86 +.Fn vmem_add ;
  87   87  or implicitly, by importing, as described in
  88   88  .Sx Imported Memory
  89   89  below.
  90   90  .Ss Segments
  91   91  Spans are subdivided into
  92   92  .Em segments ,
  93   93  each of which is either allocated or free.  A segment, like a span, is a
  94   94  contiguous range of integers.  Each allocated segment
  95   95  .Li "[addr, addr + size)"
  96   96  represents exactly one
↓ open down ↓ 18 lines elided ↑ open up ↑
 115  115  other arenas.  For example,
 116  116  .Sy kmem_va_arena
 117  117  (a virtual address cache
 118  118  that satisfies most
 119  119  .Fn kmem_slab_create
 120  120  requests) is just a subset of
 121  121  .Sy heap_arena
 122  122  (the kernel heap) that provides caching for the most common slab sizes.  When
 123  123  .Sy kmem_va_arena
 124  124  runs out of virtual memory, it
 125      -.Em imports more from the heap; we
 126      -say that
      125 +.Em imports
      126 +more from the heap; we say that
 127  127  .Sy heap_arena
 128  128  is the
 129      -.Em "vmem source" for
      129 +.Em "vmem source"
      130 +for
 130  131  .Sy kmem_va_arena.
 131  132  .Fn vmem_create
 132  133  allows you to specify any existing vmem arena as the source for your new
 133  134  arena.  Topologically, since every arena is a child of at most one source, the
 134  135  set of all arenas forms a collection of trees.
 135  136  .Ss Constrained Allocations
 136  137  Some vmem clients are quite picky about the kind of address they want.
 137  138  For example, the DVMA code may need an address that is at a particular
 138  139  phase with respect to some alignment (to get good cache coloring), or
 139  140  that lies within certain limits (the addressable range of a device),
↓ open down ↓ 36 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX