# HG changeset patch # User dp78419 # Date 1172710511 28800 # Node ID f1b41f5144ccdb3fac8db6f4d3aaed7fd6b3de87 # Parent c8e62d396494732a40d6bb89b8f87585e26e8762 6528905 group colorequiv colors on N2 by low order bits of the color first diff -r c8e62d396494 -r f1b41f5144cc usr/src/uts/common/vm/vm_pagelist.c --- a/usr/src/uts/common/vm/vm_pagelist.c Wed Feb 28 16:33:41 2007 -0800 +++ b/usr/src/uts/common/vm/vm_pagelist.c Wed Feb 28 16:55:11 2007 -0800 @@ -4168,14 +4168,15 @@ page_set_colorequiv_arr(void) { if (colorequiv > 1) { - uint_t colors; int i; - int a = lowbit(colorequiv) - 1; - - if (a > 15) - a = 15; + uint_t sv_a = lowbit(colorequiv) - 1; + + if (sv_a > 15) + sv_a = 15; for (i = 0; i < MMU_PAGE_SIZES; i++) { + uint_t colors; + uint_t a = sv_a; if ((colors = hw_page_array[i].hp_colors) <= 1) { continue; diff -r c8e62d396494 -r f1b41f5144cc usr/src/uts/sun4/os/startup.c --- a/usr/src/uts/sun4/os/startup.c Wed Feb 28 16:33:41 2007 -0800 +++ b/usr/src/uts/sun4/os/startup.c Wed Feb 28 16:55:11 2007 -0800 @@ -752,6 +752,9 @@ pgcnt_t tune_npages = (pgcnt_t) (MB_TO_BYTES(MINMOVE_RAM_MB)/ (size_t)MMU_PAGESIZE); +#pragma weak page_set_colorequiv_arr_cpu +extern void page_set_colorequiv_arr_cpu(void); + static void startup_memlist(void) { @@ -1530,7 +1533,10 @@ /* * Factor in colorequiv to check additional 'equivalent' bins */ - page_set_colorequiv_arr(); + if (&page_set_colorequiv_arr_cpu != NULL) + page_set_colorequiv_arr_cpu(); + else + page_set_colorequiv_arr(); /* * Initialize bp_mapin(). diff -r c8e62d396494 -r f1b41f5144cc usr/src/uts/sun4v/cpu/niagara2.c --- a/usr/src/uts/sun4v/cpu/niagara2.c Wed Feb 28 16:33:41 2007 -0800 +++ b/usr/src/uts/sun4v/cpu/niagara2.c Wed Feb 28 16:55:11 2007 -0800 @@ -462,3 +462,40 @@ hw_page_array[i].hp_colors = 1 << 5; } } + +/* + * group colorequiv colors on N2 by low order bits of the color first + */ +void +page_set_colorequiv_arr_cpu(void) +{ + static uint_t nequiv_shades_log2[MMU_PAGE_SIZES] = {2, 5, 0, 0, 0, 0}; + + if (colorequiv > 1) { + int i; + uint_t sv_a = lowbit(colorequiv) - 1; + + if (sv_a > 15) + sv_a = 15; + + for (i = 0; i < MMU_PAGE_SIZES; i++) { + uint_t colors; + uint_t a = sv_a; + + if ((colors = hw_page_array[i].hp_colors) <= 1) + continue; + while ((colors >> a) == 0) + a--; + if (a > (colorequivszc[i] & 0xf) + + (colorequivszc[i] >> 4)) { + if (a <= nequiv_shades_log2[i]) { + colorequivszc[i] = a; + } else { + colorequivszc[i] = + ((a - nequiv_shades_log2[i]) << 4) | + nequiv_shades_log2[i]; + } + } + } + } +}