summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-03-14 05:33:09 +0000
committeralc <alc@FreeBSD.org>2009-03-14 05:33:09 +0000
commit72d28b3f411899b5af82a64b66e3ebb86d4f77b8 (patch)
tree3e08e45e3d80930de306d93efcb9bffe71e19ebb
parent08eb82238e2aa57a673674eb3e90666d2c47277f (diff)
downloadFreeBSD-src-72d28b3f411899b5af82a64b66e3ebb86d4f77b8.zip
FreeBSD-src-72d28b3f411899b5af82a64b66e3ebb86d4f77b8.tar.gz
Correct accounting errors in _pmap_allocpte(). Specifically, the pmap's
resident page count and the global wired page count were not correctly maintained when page table page allocation failed. MFC after: 6 weeks
-rw-r--r--sys/amd64/amd64/pmap.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index f9cbad2..e367944 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1442,8 +1442,6 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
* it isn't already there.
*/
- pmap->pm_stats.resident_count++;
-
if (ptepindex >= (NUPDE + NUPDPE)) {
pml4_entry_t *pml4;
vm_pindex_t pml4index;
@@ -1469,7 +1467,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index,
flags) == NULL) {
--m->wire_count;
- vm_page_free(m);
+ atomic_subtract_int(&cnt.v_wire_count, 1);
+ vm_page_free_zero(m);
return (NULL);
}
} else {
@@ -1501,7 +1500,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
if (_pmap_allocpte(pmap, NUPDE + pdpindex,
flags) == NULL) {
--m->wire_count;
- vm_page_free(m);
+ atomic_subtract_int(&cnt.v_wire_count, 1);
+ vm_page_free_zero(m);
return (NULL);
}
pdp = (pdp_entry_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME);
@@ -1514,7 +1514,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
if (_pmap_allocpte(pmap, NUPDE + pdpindex,
flags) == NULL) {
--m->wire_count;
- vm_page_free(m);
+ atomic_subtract_int(&cnt.v_wire_count,
+ 1);
+ vm_page_free_zero(m);
return (NULL);
}
} else {
@@ -1530,6 +1532,8 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
*pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
}
+ pmap->pm_stats.resident_count++;
+
return m;
}
OpenPOWER on IntegriCloud