svn commit: r214558 - stable/7/sys/vm

Alan Cox alc at FreeBSD.org
Sat Oct 30 16:09:16 UTC 2010


Author: alc
Date: Sat Oct 30 16:09:15 2010
New Revision: 214558
URL: http://svn.freebsd.org/changeset/base/214558

Log:
  MFC r213408
    If vm_map_find() is asked to allocate a superpage-aligned region of
    virtual addresses that is greater than a superpage in size but not a
    multiple of the superpage size, then vm_map_find() is not always
    expanding the kernel pmap to support the last few small pages being
    allocated.  Previously, we grew the kernel page table in
    vm_map_findspace() when we found the first available virtual address.
    Now, instead, we defer the call to pmap_growkernel() until we are
    committed to a range of virtual addresses in vm_map_insert().

Modified:
  stable/7/sys/vm/vm_map.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/vm/vm_map.c
==============================================================================
--- stable/7/sys/vm/vm_map.c	Sat Oct 30 16:02:16 2010	(r214557)
+++ stable/7/sys/vm/vm_map.c	Sat Oct 30 16:09:15 2010	(r214558)
@@ -978,6 +978,9 @@ vm_map_insert(vm_map_t map, vm_object_t 
 	if (cow & MAP_DISABLE_COREDUMP)
 		protoeflags |= MAP_ENTRY_NOCOREDUMP;
 
+	/* Expand the kernel pmap, if necessary. */
+	if (map == kernel_map && end > kernel_vm_end)
+		pmap_growkernel(end);
 	if (object != NULL) {
 		/*
 		 * OBJ_ONEMAPPING must be cleared unless this mapping
@@ -1099,7 +1102,7 @@ vm_map_findspace(vm_map_t map, vm_offset
     vm_offset_t *addr)	/* OUT */
 {
 	vm_map_entry_t entry;
-	vm_offset_t end, st;
+	vm_offset_t st;
 
 	/*
 	 * Request must fit within min/max VM address and must avoid
@@ -1113,7 +1116,7 @@ vm_map_findspace(vm_map_t map, vm_offset
 	/* Empty tree means wide open address space. */
 	if (map->root == NULL) {
 		*addr = start;
-		goto found;
+		return (0);
 	}
 
 	/*
@@ -1123,7 +1126,7 @@ vm_map_findspace(vm_map_t map, vm_offset
 	map->root = vm_map_entry_splay(start, map->root);
 	if (start + length <= map->root->start) {
 		*addr = start;
-		goto found;
+		return (0);
 	}
 
 	/*
@@ -1134,7 +1137,7 @@ vm_map_findspace(vm_map_t map, vm_offset
 	st = (start > map->root->end) ? start : map->root->end;
 	if (length <= map->root->end + map->root->adj_free - st) {
 		*addr = st;
-		goto found;
+		return (0);
 	}
 
 	/* With max_free, can immediately tell if no solution. */
@@ -1152,22 +1155,13 @@ vm_map_findspace(vm_map_t map, vm_offset
 			entry = entry->left;
 		else if (entry->adj_free >= length) {
 			*addr = entry->end;
-			goto found;
+			return (0);
 		} else
 			entry = entry->right;
 	}
 
 	/* Can't get here, so panic if we do. */
 	panic("vm_map_findspace: max_free corrupt");
-
-found:
-	/* Expand the kernel pmap, if necessary. */
-	if (map == kernel_map) {
-		end = round_page(*addr + length);
-		if (end > kernel_vm_end)
-			pmap_growkernel(end);
-	}
-	return (0);
 }
 
 int


More information about the svn-src-all mailing list