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
This commit is contained in:
Alan Cox 2009-03-14 05:33:09 +00:00
parent d9c4315930
commit 957939b503

View File

@ -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;
}