changeset 50:aefb62525908

6266922 page_get_replacement_page may fail with 256M pages 6274712 no memnodes in parent lgroup of leaf lgroups with no memory 6274882 Remove lgrp_plat_build_topo() since it is unused 6274894 lgrp_plat_latency_verify() shouldn't use lgrp_plat_probe_times[0][0] as local latency 6274899 lgrp_mem_init() has mistake in accounting for lgroups changed
author jjc
date Tue, 21 Jun 2005 16:15:29 -0700
parents 94a4476520ba
children 74f638aae10d
files usr/src/uts/common/os/lgrp.c usr/src/uts/common/sys/lgrp.h usr/src/uts/common/vm/vm_pagelist.c usr/src/uts/i86pc/os/lgrpplat.c usr/src/uts/sun4/os/lgrpplat.c
diffstat 5 files changed, 43 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/os/lgrp.c	Tue Jun 21 15:12:48 2005 -0700
+++ b/usr/src/uts/common/os/lgrp.c	Tue Jun 21 16:15:29 2005 -0700
@@ -650,6 +650,11 @@
 		klgrpset_clear(changed);
 		count += lgrp_leaf_add(my_lgrp, lgrp_table, lgrp_alloc_max + 1,
 		    &changed);
+		/*
+		 * May have added new intermediate lgroups, so need to add
+		 * resources other than CPUs which are added below
+		 */
+		(void) lgrp_mnode_update(changed, NULL);
 	} else if (my_lgrp->lgrp_latency == 0 && lgrp_plat_latency(hand, hand)
 	    > 0) {
 		/*
@@ -1275,9 +1280,9 @@
 			start_cpus();
 	} else if (!klgrpset_ismember(my_lgrp->lgrp_set[LGRP_RSRC_MEM],
 	    my_lgrp->lgrp_id)) {
-		klgrpset_add(changed, lgrpid);
-		count = 1;
-
+		/*
+		 * Add new lgroup memory resource to existing lgroup
+		 */
 		lgrpid = my_lgrp->lgrp_id;
 		klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
 		klgrpset_add(changed, lgrpid);
--- a/usr/src/uts/common/sys/lgrp.h	Tue Jun 21 15:12:48 2005 -0700
+++ b/usr/src/uts/common/sys/lgrp.h	Tue Jun 21 16:15:29 2005 -0700
@@ -593,7 +593,6 @@
 int	lgrp_plat_latency(lgrp_handle_t, lgrp_handle_t);
 lgrp_handle_t	lgrp_plat_root_hand(void);
 void	lgrp_plat_probe(void);
-void	lgrp_plat_build_topo(void);
 
 #endif	/* _KERNEL && _KMEMUSER */
 
--- a/usr/src/uts/common/vm/vm_pagelist.c	Tue Jun 21 15:12:48 2005 -0700
+++ b/usr/src/uts/common/vm/vm_pagelist.c	Tue Jun 21 16:15:29 2005 -0700
@@ -3440,7 +3440,7 @@
  * PAGESIZE pages.
  */
 page_t *
-page_get_replacement_page(page_t *orig_like_pp, struct lgrp *lgrp,
+page_get_replacement_page(page_t *orig_like_pp, struct lgrp *lgrp_target,
     uint_t pgrflags)
 {
 	page_t		*like_pp;
@@ -3454,7 +3454,7 @@
 	int		mtype;
 	int		flags = 0;
 	lgrp_mnode_cookie_t	lgrp_cookie;
-
+	lgrp_t		*lgrp;
 
 	REPL_STAT_INCR(ngets);
 	like_pp = orig_like_pp;
@@ -3502,8 +3502,19 @@
 			/*
 			 * If an lgroup was specified, try to get the
 			 * page from that lgroup.
+			 * NOTE: Must be careful with code below because
+			 *	 lgroup may disappear and reappear since there
+			 *	 is no locking for lgroup here.
 			 */
-			if (LGRP_EXISTS(lgrp)) {
+			if (LGRP_EXISTS(lgrp_target)) {
+				/*
+				 * Keep local variable for lgroup separate
+				 * from lgroup argument since this code should
+				 * only be exercised when lgroup argument
+				 * exists....
+				 */
+				lgrp = lgrp_target;
+
 				/* Try the lgroup's freelists first */
 				LGRP_MNODE_COOKIE_INIT(lgrp_cookie, lgrp,
 				    LGRP_SRCH_LOCAL);
@@ -3544,10 +3555,10 @@
 				break;
 			}
 
-			ASSERT(!LGRP_EXISTS(lgrp));
 			/*
-			 * No lgroup was specified, so just try to get the
-			 * page as close to like_pp's mnode as possible.
+			 * No lgroup was specified (or lgroup was removed by
+			 * DR, so just try to get the page as close to
+			 * like_pp's mnode as possible.
 			 * First try the local freelist...
 			 */
 			mnode = PP_2_MEM_NODE(like_pp);
--- a/usr/src/uts/i86pc/os/lgrpplat.c	Tue Jun 21 15:12:48 2005 -0700
+++ b/usr/src/uts/i86pc/os/lgrpplat.c	Tue Jun 21 16:15:29 2005 -0700
@@ -834,10 +834,11 @@
 	u_longlong_t			t2;
 
 	/*
-	 * Nothing to do when this is an UMA machine
+	 * Nothing to do when this is an UMA machine, lgroup topology is
+	 * limited to 2 levels, or there aren't any probe times yet
 	 */
 	if (max_mem_nodes == 1 || lgrp_topo_levels < 2 ||
-	    lgrp_plat_probe_times[0][0] == 0)
+	    (lgrp_plat_probe_time_max == 0 && lgrp_plat_probe_time_min == -1))
 		return (0);
 
 	/*
@@ -864,6 +865,11 @@
 		if (t2 == 0)
 			continue;
 
+		if (t1 == 0) {
+			t1 = t2;
+			continue;
+		}
+
 		if (t1 != t2)
 			return (-2);
 	}
@@ -871,16 +877,17 @@
 	/*
 	 * Local latencies should be less than remote
 	 */
-	t1 = lgrp_plat_probe_times[0][0];
-	for (i = 0; i < lgrp_plat_node_cnt; i++)
-		for (j = 0; j < lgrp_plat_node_cnt; j++) {
-			if (i == j || t2 == 0)
-				continue;
+	if (t1) {
+		for (i = 0; i < lgrp_plat_node_cnt; i++)
+			for (j = 0; j < lgrp_plat_node_cnt; j++) {
+				t2 = lgrp_plat_probe_times[i][j];
+				if (i == j || t2 == 0)
+					continue;
 
-			t2 = lgrp_plat_probe_times[i][j];
-			if (t1 >= t2)
-				return (-3);
-		}
+				if (t1 >= t2)
+					return (-3);
+			}
+	}
 
 	/*
 	 * Rest of checks are not very useful for machines with less than
--- a/usr/src/uts/sun4/os/lgrpplat.c	Tue Jun 21 15:12:48 2005 -0700
+++ b/usr/src/uts/sun4/os/lgrpplat.c	Tue Jun 21 16:15:29 2005 -0700
@@ -350,14 +350,6 @@
 }
 
 /*
- * Do any platform specific preparation and/or building of full lgroup topology
- */
-void
-lgrp_plat_build_topo(void)
-{
-}
-
-/*
  * Probe memory in each node from current CPU to determine latency topology
  */
 void