Index: sys/vm/vm_radix.c =================================================================== --- sys/vm/vm_radix.c (revisione 235178) +++ sys/vm/vm_radix.c (copia locale) @@ -97,6 +97,7 @@ CTASSERT(sizeof(struct vm_radix_node) < PAGE_SIZE); static uma_zone_t vm_radix_node_zone; +static u_long allocfail; #ifndef UMA_MD_SMALL_ALLOC static vm_map_t rnode_map; @@ -192,6 +193,10 @@ vm_radix_node_get(void) { + if (++allocfail == 100000000) { + allocfail = 0; + return (NULL); + } return (uma_zalloc(vm_radix_node_zone, M_NOWAIT | M_ZERO)); } @@ -280,11 +285,11 @@ rtree->rt_root = root; } -static inline void -vm_radix_unwind_heightup(struct vm_radix *rtree, struct vm_radix_node *root, - struct vm_radix_node *iroot, int ilevel) +static void +vm_radix_unwind_heightup(struct vm_radix *rtree, volatile struct vm_radix_node *root, + volatile struct vm_radix_node *iroot, int ilevel) { - struct vm_radix_node *rnode; + volatile struct vm_radix_node *rnode; CTR4(KTR_VM, "unwind: tree %p, root %p, iroot %p, ilevel %d", rtree, root, iroot, ilevel); @@ -293,9 +298,9 @@ MPASS(rnode->rn_count == 0 || rnode->rn_count == 1); rnode->rn_count = 0; root = rnode->rn_child[0]; - vm_radix_node_put(rnode); + vm_radix_node_put(__DEVOLATILE(struct vm_radix_node *, rnode)); } - vm_radix_setroot(rtree, iroot, ilevel); + vm_radix_setroot(rtree, __DEVOLATILE(struct vm_radix_node *, iroot), ilevel); } static inline void * @@ -349,15 +354,15 @@ int vm_radix_insert(struct vm_radix *rtree, vm_pindex_t index, void *val) { - struct vm_radix_node *iroot, *rnode, *root; - u_int allocmsk; - int clev, ilevel, level, slot; + volatile struct vm_radix_node *iroot, *rnode, *root; + volatile u_int allocmsk; + volatile int clev, ilevel, level, slot; CTR3(KTR_VM, "insert: tree %p, index %ju, val %p", rtree, (uintmax_t)index, val); if (index == -1) panic("vm_radix_insert: -1 is not a valid index.\n"); - level = vm_radix_height(rtree, &root); + level = vm_radix_height(rtree, __DEVOLATILE(struct vm_radix_node **, &root)); /* * Increase the height by adding nodes at the root until * there is sufficient space. @@ -395,7 +400,7 @@ } root = rnode; } - vm_radix_setroot(rtree, root, level); + vm_radix_setroot(rtree, __DEVOLATILE(struct vm_radix_node *, root), level); } /* Now that the tree is tall enough, fill in the path to the index. */