Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode Enhance the page_deactivate() to ...



details:   https://anonhg.NetBSD.org/src/rev/91072a30d43e
branches:  trunk
changeset: 772462:91072a30d43e
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Wed Jan 04 16:20:41 2012 +0000

description:
Enhance the page_deactivate() to have less side effects. While here also make
a variable local to the debug routine that uses it.

diffstat:

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

diffs (55 lines):

diff -r 6916175318ab -r 91072a30d43e sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Wed Jan 04 16:18:11 2012 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Wed Jan 04 16:20:41 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.95 2012/01/04 15:10:45 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.96 2012/01/04 16:20:41 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.95 2012/01/04 15:10:45 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.96 2012/01/04 16:20:41 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -480,7 +480,7 @@
 pmap_destroy(pmap_t pmap)
 {
        struct pmap_l2 *l2tbl;
-       int l1, l2;
+       int l1;
 
        /* if multiple references exist just remove a reference */
        thunk_printf_debug("pmap_destroy %p\n", pmap);
@@ -494,6 +494,8 @@
        KASSERT(pmap->pm_stats.wired_count == 0);
 #ifdef DIAGNOSTIC
        for (l1 = 0; l1 < pm_nl1; l1++) {
+               int l2;
+
                l2tbl = pmap->pm_l1[l1];
                if (!l2tbl)
                        continue;
@@ -761,8 +763,9 @@
        /* don't try to unmap pv entries that are already unmapped */
        if (!tlb[pv->pv_lpn])
                return;
+
        if (tlb[pv->pv_lpn]->pv_mmap_ppl == THUNK_PROT_NONE)
-               return;
+               goto deactivate;
 
        map_flags = THUNK_MAP_FILE | THUNK_MAP_FIXED | THUNK_MAP_SHARED;
        addr = thunk_mmap((void *) va, PAGE_SIZE, THUNK_PROT_NONE,
@@ -772,6 +775,7 @@
        if (addr != (void *) va)
                panic("pmap_page_deactivate: mmap failed");
 
+deactivate:
        tlb[pv->pv_lpn] = NULL;
 }
 



Home | Main Index | Thread Index | Old Index