Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 in pmap_growkernel(), make sure we ...



details:   https://anonhg.NetBSD.org/src/rev/949b210ffdac
branches:  trunk
changeset: 752084:949b210ffdac
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Feb 13 08:56:29 2010 +0000

description:
in pmap_growkernel(), make sure we only mutex_exit() if we mutex_enter()ed.

diffstat:

 sys/arch/sparc64/sparc64/pmap.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 6b9482f8c8a7 -r 949b210ffdac sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c   Sat Feb 13 08:54:58 2010 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c   Sat Feb 13 08:56:29 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.250 2010/02/05 12:04:10 martin Exp $        */
+/*     $NetBSD: pmap.c,v 1.251 2010/02/13 08:56:29 mrg Exp $   */
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.250 2010/02/05 12:04:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.251 2010/02/13 08:56:29 mrg Exp $");
 
 #undef NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define        HWREF
@@ -1306,13 +1306,16 @@
 {
        struct pmap *pm = pmap_kernel();
        paddr_t pa;
+       bool took_lock;
 
        if (maxkvaddr >= KERNEND) {
                printf("WARNING: cannot extend kernel pmap beyond %p to %p\n",
                       (void *)KERNEND, (void *)maxkvaddr);
                return (kbreak);
        }
-       if (__predict_true(lock_available)) mutex_enter(&pmap_lock);
+       took_lock = lock_available;
+       if (__predict_true(took_lock))
+               mutex_enter(&pmap_lock);
        DPRINTF(PDB_GROW, ("pmap_growkernel(%lx...%lx)\n", kbreak, maxkvaddr));
        /* Align with the start of a page table */
        for (kbreak &= (-1 << PDSHIFT); kbreak < maxkvaddr;
@@ -1330,7 +1333,8 @@
                        ENTER_STAT(ptpneeded);
                }
        }
-       if (__predict_true(lock_available)) mutex_exit(&pmap_lock);
+       if (__predict_true(took_lock))
+               mutex_exit(&pmap_lock);
        return (kbreak);
 }
 



Home | Main Index | Thread Index | Old Index