Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm Remove locking since it isn't needed. As soon as th...



details:   https://anonhg.NetBSD.org/src/rev/16d3ae779379
branches:  trunk
changeset: 781404:16d3ae779379
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Sep 04 13:37:41 2012 +0000

description:
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.

diffstat:

 sys/uvm/uvm_km.c  |  9 +++++----
 sys/uvm/uvm_map.c |  6 ++----
 2 files changed, 7 insertions(+), 8 deletions(-)

diffs (66 lines):

diff -r 2bbd68d1499c -r 16d3ae779379 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Tue Sep 04 00:21:08 2012 +0000
+++ b/sys/uvm/uvm_km.c  Tue Sep 04 13:37:41 2012 +0000
@@ -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 @@
        /*
         * 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;
diff -r 2bbd68d1499c -r 16d3ae779379 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Tue Sep 04 00:21:08 2012 +0000
+++ b/sys/uvm/uvm_map.c Tue Sep 04 13:37:41 2012 +0000
@@ -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 @@
         * 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);



Home | Main Index | Thread Index | Old Index