Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm/pmap Increment resident_count if we're remapping ont...



details:   https://anonhg.NetBSD.org/src/rev/c24609fad9e6
branches:  trunk
changeset: 348018:c24609fad9e6
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Sep 30 12:10:40 2016 +0000

description:
Increment resident_count if we're remapping onto new PA as
pmap_remove -> pmap_pte_remote will decrement it

diffstat:

 sys/uvm/pmap/pmap.c |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r 8aee188a5e89 -r c24609fad9e6 sys/uvm/pmap/pmap.c
--- a/sys/uvm/pmap/pmap.c       Fri Sep 30 06:22:21 2016 +0000
+++ b/sys/uvm/pmap/pmap.c       Fri Sep 30 12:10:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.22 2016/09/16 17:27:09 matt Exp $   */
+/*     $NetBSD: pmap.c,v 1.23 2016/09/30 12:10:40 skrll Exp $  */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.22 2016/09/16 17:27:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.23 2016/09/30 12:10:40 skrll Exp $");
 
 /*
  *     Manages physical address maps.
@@ -1272,16 +1272,19 @@
        UVMHIST_LOG(*histp, "new pte %#"PRIxPTE" (pa %#"PRIxPADDR")",
            pte_value(npte), pa, 0, 0);
 
-       if (pte_valid_p(opte) && pte_to_paddr(opte) != pa) {
-               pmap_remove(pmap, va, va + NBPG);
-               PMAP_COUNT(user_mappings_changed);
+       KASSERT(pte_valid_p(npte));
+       const bool resident = pte_valid_p(opte);
+       bool remap = false;
+       if (resident) {
+               if (pte_to_paddr(opte) != pa) {
+                       pmap_remove(pmap, va, va + NBPG);
+                       PMAP_COUNT(user_mappings_changed);
+                       remap = true;
+               }
+               update_flags |= PMAP_TLB_NEED_IPI;
        }
 
-       KASSERT(pte_valid_p(npte));
-       const bool resident = pte_valid_p(opte);
-       if (resident) {
-               update_flags |= PMAP_TLB_NEED_IPI;
-       } else {
+       if (!resident || remap) {
                pmap->pm_stats.resident_count++;
        }
 



Home | Main Index | Thread Index | Old Index