Module Name:    src
Committed By:   matt
Date:           Tue Sep  4 13:37:44 UTC 2012

Modified Files:
        src/sys/uvm: uvm_km.c uvm_map.c

Log Message:
Remove locking since it isn't needed.  As soon as the 2nd uvm_map_entry in 
kernel_map
is created, uvm_map_prepare will call pmap_growkernel and the pmap_growkernel 
call in
uvm_km_mem_alloc will never be called again.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.321 -r1.322 src/sys/uvm/uvm_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.133 src/sys/uvm/uvm_km.c:1.134
--- src/sys/uvm/uvm_km.c:1.133	Mon Sep  3 19:53:42 2012
+++ src/sys/uvm/uvm_km.c	Tue Sep  4 13:37:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.133 2012/09/03 19:53:42 matt Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.134 2012/09/04 13:37:41 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -152,7 +152,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.133 2012/09/03 19:53:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.134 2012/09/04 13:37:41 matt Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -784,15 +784,16 @@ again:
 	/*
 	 * These VA allocations happen independently of uvm_map so if this allocation
 	 * extends beyond the current limit, then allocate more resources for it.
+	 * This can only happen while the kmem_map is the only map entry in the
+	 * kernel_map because as soon as another map entry is created, uvm_map_prepare
+	 * will set uvm_maxkaddr to an address beyond the kmem_map.
 	 */
-	mutex_enter(&uvm_kentry_lock);
 	if (uvm_maxkaddr < va + size) {
 		uvm_maxkaddr = pmap_growkernel(va + size);
 		KASSERTMSG(uvm_maxkaddr >= va + size,
 		    "%#"PRIxVADDR" %#"PRIxPTR" %#zx",
 		    uvm_maxkaddr, va, size);
 	}
-	mutex_exit(&uvm_kentry_lock);
 #endif
 
 	loopva = va;

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.321 src/sys/uvm/uvm_map.c:1.322
--- src/sys/uvm/uvm_map.c:1.321	Mon Sep  3 19:53:42 2012
+++ src/sys/uvm/uvm_map.c	Tue Sep  4 13:37:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.321 2012/09/03 19:53:42 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.321 2012/09/03 19:53:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -1182,10 +1182,8 @@ retry:
 	 * If the kernel pmap can't map the requested space,
 	 * then allocate more resources for it.
 	 */
-	mutex_enter(&uvm_kentry_lock);
 	if (map == kernel_map && uvm_maxkaddr < (start + size))
 		uvm_maxkaddr = pmap_growkernel(start + size);
-	mutex_exit(&uvm_kentry_lock);
 #endif
 
 	UVMMAP_EVCNT_INCR(map_call);

Reply via email to