Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/arch/i386/i386 Pull up revision 1.136 (via patch, r...
details: https://anonhg.NetBSD.org/src/rev/f413402a1c1c
branches: netbsd-1-5
changeset: 493013:f413402a1c1c
user: he <he%NetBSD.org@localhost>
date: Thu Mar 28 22:45:17 2002 +0000
description:
Pull up revision 1.136 (via patch, requested by chs):
Avoid accounting errors in pmap_enter() by only updating the counters
once the operation can no longer fail. Fixes PR#16028.
diffstat:
sys/arch/i386/i386/pmap.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diffs (80 lines):
diff -r 2d3b15862aff -r f413402a1c1c sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Thu Mar 28 22:40:22 2002 +0000
+++ b/sys/arch/i386/i386/pmap.c Thu Mar 28 22:45:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.94.2.3 2000/10/09 04:46:00 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.94.2.4 2002/03/28 22:45:17 he Exp $ */
/*
*
@@ -3453,6 +3453,7 @@
struct pv_head *pvh;
struct pv_entry *pve;
int bank, off, error;
+ int ptpdelta, wireddelta, resdelta;
boolean_t wired = (flags & PMAP_WIRED) != 0;
#ifdef DIAGNOSTIC
@@ -3497,15 +3498,19 @@
if (pmap_valid_entry(opte)) {
/*
- * first, update pm_stats. resident count will not
- * change since we are replacing/changing a valid
- * mapping. wired count might change...
+ * first, calculate pm_stats updates. resident count will not
+ * change since we are replacing/changing a valid mapping.
+ * wired count might change...
*/
+ resdelta = 0;
if (wired && (opte & PG_W) == 0)
- pmap->pm_stats.wired_count++;
+ wireddelta = 1;
else if (!wired && (opte & PG_W) != 0)
- pmap->pm_stats.wired_count--;
+ wireddelta = -1;
+ else
+ wireddelta = 0;
+ ptpdelta = 0;
/*
* is the currently mapped PA the same as the one we
@@ -3561,17 +3566,20 @@
}
} else { /* opte not valid */
pve = NULL;
- pmap->pm_stats.resident_count++;
+ resdelta = 1;
if (wired)
- pmap->pm_stats.wired_count++;
+ wireddelta = 1;
+ else
+ wireddelta = 0;
if (ptp)
- ptp->wire_count++; /* count # of valid entrys */
+ ptpdelta = 1;
+ else
+ ptpdelta = 0;
}
/*
- * at this point pm_stats has been updated. pve is either NULL
- * or points to a now-free pv_entry structure (the latter case is
- * if we called pmap_remove_pv above).
+ * pve is either NULL or points to a now-free pv_entry structure
+ * (the latter case is if we called pmap_remove_pv above).
*
* if this entry is to be on a pvlist, enter it now.
*/
@@ -3604,6 +3612,10 @@
* at this point pvh is !NULL if we want the PG_PVLIST bit set
*/
+ pmap->pm_stats.resident_count += resdelta;
+ pmap->pm_stats.wired_count += wireddelta;
+ if (ptp)
+ ptp->wire_count += ptpdelta;
npte = pa | protection_codes[prot] | PG_V;
if (pvh)
npte |= PG_PVLIST;
Home |
Main Index |
Thread Index |
Old Index