Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Oct 2010 04:53:50 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214546 - stable/8/sys/vm
Message-ID:  <201010300453.o9U4roZo080187@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sat Oct 30 04:53:50 2010
New Revision: 214546
URL: http://svn.freebsd.org/changeset/base/214546

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/8/sys/vm/vm_map.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/vm/vm_map.c
==============================================================================
--- stable/8/sys/vm/vm_map.c	Sat Oct 30 02:51:04 2010	(r214545)
+++ stable/8/sys/vm/vm_map.c	Sat Oct 30 04:53:50 2010	(r214546)
@@ -1166,6 +1166,9 @@ vm_map_insert(vm_map_t map, vm_object_t 
 	}
 
 charged:
+	/* 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
@@ -1302,7 +1305,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
@@ -1316,7 +1319,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);
 	}
 
 	/*
@@ -1326,7 +1329,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);
 	}
 
 	/*
@@ -1337,7 +1340,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. */
@@ -1355,22 +1358,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010300453.o9U4roZo080187>