From owner-svn-src-all@FreeBSD.ORG Sat Oct 30 04:53:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB3571065673; Sat, 30 Oct 2010 04:53:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AED508FC08; Sat, 30 Oct 2010 04:53:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9U4roJO080189; Sat, 30 Oct 2010 04:53:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9U4roZo080187; Sat, 30 Oct 2010 04:53:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010300453.o9U4roZo080187@svn.freebsd.org> From: Alan Cox Date: Sat, 30 Oct 2010 04:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214546 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 04:53:51 -0000 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