changeset 3733:f1b41f5144cc

6528905 group colorequiv colors on N2 by low order bits of the color first
author dp78419
date Wed, 28 Feb 2007 16:55:11 -0800
parents c8e62d396494
children cc8896fe34a1
files usr/src/uts/common/vm/vm_pagelist.c usr/src/uts/sun4/os/startup.c usr/src/uts/sun4v/cpu/niagara2.c
diffstat 3 files changed, 50 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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().
--- 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];
+				}
+			}
+		}
+	}
+}