51a52,54
> #ifndef UMA_MD_SMALL_ALLOC
> #include <vm/vm_map.h>
> #endif
56a60,69
> #ifndef UMA_MD_SMALL_ALLOC
> #define VM_RADIX_RNODE_MAP_SCALE (1024 * 1024 / 2)
> #define VM_RADIX_WIDTH 4
>
> /*
> * Bits of height in root.
> * The mask of smaller power of 2 containing VM_RADIX_LIMIT.
> */
> #define VM_RADIX_HEIGHT 0x1f
> #else
57a71,75
>
> /* See the comment above. */
> #define VM_RADIX_HEIGHT 0xf
> #endif
>
66,68d83
< /* Bits of height in root. */
< #define VM_RADIX_HEIGHT 0xf
<
86a102,104
> static vm_map_t rnode_map;
> static u_long rnode_map_scale;
>
94c112
< /* Inform UMA that this allocator uses kernel_map. */
---
> /* Inform UMA that this allocator uses rnode_map. */
107c125
< addr = kmem_alloc_nofault(kernel_map, size);
---
> addr = kmem_alloc_nofault(rnode_map, size);
115c133
< kmem_free(kernel_map, addr, size);
---
> kmem_free(rnode_map, addr, size);
135a154,155
> vm_page_lock(m);
> vm_page_unwire(m, 0);
137c157,158
< kmem_free(kernel_map, voitem, size);
---
> vm_page_unlock(m);
> kmem_free(rnode_map, voitem, size);
143a165
> uma_zone_set_max(vm_radix_node_zone, rnode_map_scale);
195a218,230
> /*
> * Initialize the radix node submap (for architectures not supporting
> * direct-mapping) and the radix node zone.
> *
> * WITNESS reports a lock order reversal, for architectures not
> * supporting direct-mapping, between the "system map" lock
> * and the "vm object" lock. This is because the well established ordering
> * "system map" -> "vm object" is not honoured in this case as allocating
> * from the radix node submap ends up adding a mapping entry to it, meaning
> * it is necessary to lock the submap. However, the radix node submap is
> * a leaf and self-contained, thus a deadlock cannot happen here and
> * adding MTX_NOWITNESS to all map locks would be largerly sub-optimal.
> */
198a234,235
> #ifndef UMA_MD_SMALL_ALLOC
> vm_offset_t maxaddr, minaddr;
199a237,243
> rnode_map_scale = VM_RADIX_RNODE_MAP_SCALE;
> TUNABLE_ULONG_FETCH("hw.rnode_map_scale", &rnode_map_scale);
> rnode_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
> rnode_map_scale * sizeof(struct vm_radix_node), FALSE);
> rnode_map->system_map = 1;
> #endif
>
> #ifndef UMA_MD_SMALL_ALLOC
> #include <vm/vm_map.h>
> #endif
56a60,69
> #ifndef UMA_MD_SMALL_ALLOC
> #define VM_RADIX_RNODE_MAP_SCALE (1024 * 1024 / 2)
> #define VM_RADIX_WIDTH 4
>
> /*
> * Bits of height in root.
> * The mask of smaller power of 2 containing VM_RADIX_LIMIT.
> */
> #define VM_RADIX_HEIGHT 0x1f
> #else
57a71,75
>
> /* See the comment above. */
> #define VM_RADIX_HEIGHT 0xf
> #endif
>
66,68d83
< /* Bits of height in root. */
< #define VM_RADIX_HEIGHT 0xf
<
86a102,104
> static vm_map_t rnode_map;
> static u_long rnode_map_scale;
>
94c112
< /* Inform UMA that this allocator uses kernel_map. */
---
> /* Inform UMA that this allocator uses rnode_map. */
107c125
< addr = kmem_alloc_nofault(kernel_map, size);
---
> addr = kmem_alloc_nofault(rnode_map, size);
115c133
< kmem_free(kernel_map, addr, size);
---
> kmem_free(rnode_map, addr, size);
135a154,155
> vm_page_lock(m);
> vm_page_unwire(m, 0);
137c157,158
< kmem_free(kernel_map, voitem, size);
---
> vm_page_unlock(m);
> kmem_free(rnode_map, voitem, size);
143a165
> uma_zone_set_max(vm_radix_node_zone, rnode_map_scale);
195a218,230
> /*
> * Initialize the radix node submap (for architectures not supporting
> * direct-mapping) and the radix node zone.
> *
> * WITNESS reports a lock order reversal, for architectures not
> * supporting direct-mapping, between the "system map" lock
> * and the "vm object" lock. This is because the well established ordering
> * "system map" -> "vm object" is not honoured in this case as allocating
> * from the radix node submap ends up adding a mapping entry to it, meaning
> * it is necessary to lock the submap. However, the radix node submap is
> * a leaf and self-contained, thus a deadlock cannot happen here and
> * adding MTX_NOWITNESS to all map locks would be largerly sub-optimal.
> */
198a234,235
> #ifndef UMA_MD_SMALL_ALLOC
> vm_offset_t maxaddr, minaddr;
199a237,243
> rnode_map_scale = VM_RADIX_RNODE_MAP_SCALE;
> TUNABLE_ULONG_FETCH("hw.rnode_map_scale", &rnode_map_scale);
> rnode_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
> rnode_map_scale * sizeof(struct vm_radix_node), FALSE);
> rnode_map->system_map = 1;
> #endif
>