Print this page
6138 don't abuse atomic_cas_*
@@ -886,23 +886,17 @@
/* ARGSUSED */
uint_t
get_color_start(struct as *as)
{
- uint32_t old, new;
-
if (consistent_coloring == 2 || color_start_random) {
return ((uint_t)(((gettick()) << (vac_shift - MMU_PAGESHIFT)) &
(hw_page_array[0].hp_colors - 1)));
}
- do {
- old = color_start_current;
- new = old + (color_start_stride << (vac_shift - MMU_PAGESHIFT));
- } while (atomic_cas_32(&color_start_current, old, new) != old);
-
- return ((uint_t)(new));
+ return ((uint_t)atomic_add_32_nv(&color_start_current,
+ color_start_stride << (vac_shift - MMU_PAGESHIFT)));
}
/*
* Called once at startup from kphysm_init() -- before memialloc()
* is invoked to do the 1st page_free()/page_freelist_add().