changeset 11678:190a879b0485

6917417 jvm failure to mmap 3G memory segment on new Opteron processors 2384
author Sudheer A <Sudheer.Abdul-Salam@Sun.COM>
date Wed, 17 Feb 2010 17:32:56 -0800
parents 27c9e0b8bb64
children d52267d340fe
files usr/src/uts/i86pc/vm/vm_machdep.c
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/vm/vm_machdep.c	Wed Feb 17 17:01:21 2010 -0800
+++ b/usr/src/uts/i86pc/vm/vm_machdep.c	Wed Feb 17 17:32:56 2010 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -717,14 +717,20 @@
 		 */
 		align_amount = ELF_386_MAXPGSZ;
 	} else {
-		int l = mmu.umax_page_level;
-
-		while (l && len < LEVEL_SIZE(l))
-			--l;
-
-		align_amount = LEVEL_SIZE(l);
+		/*
+		 * For 32-bit processes, only those which have specified
+		 * MAP_ALIGN and an addr will be aligned on a larger page size.
+		 * Not doing so can potentially waste up to 1G of process
+		 * address space.
+		 */
+		int lvl = (p->p_model == DATAMODEL_ILP32) ? 1 :
+		    mmu.umax_page_level;
+
+		while (lvl && len < LEVEL_SIZE(lvl))
+			--lvl;
+
+		align_amount = LEVEL_SIZE(lvl);
 	}
-
 	if ((flags & MAP_ALIGN) && ((uintptr_t)*addrp > align_amount))
 		align_amount = (uintptr_t)*addrp;