Fix lock order reversal, unlock page queue and pmap locks before

calling uma_zfree().
Also if needed, acquire page queue lock before modifying pte page
attributes.

Approved by:	rrs (mentor)
This commit is contained in:
Jayachandran C. 2010-05-28 12:05:56 +00:00
parent 6365985dfc
commit 9be223a169
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208616

View File

@ -885,8 +885,12 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m)
/*
* If the page is finally unwired, simply free it.
*/
pmap_release_pte_page(m);
atomic_subtract_int(&cnt.v_wire_count, 1);
PMAP_UNLOCK(pmap);
vm_page_unlock_queues();
pmap_release_pte_page(m);
vm_page_lock_queues();
PMAP_LOCK(pmap);
return (1);
}
@ -1007,9 +1011,14 @@ pmap_alloc_pte_page(pmap_t pmap, unsigned int index, int wait, vm_offset_t *vap)
paddr = MIPS_KSEG0_TO_PHYS(va);
m = PHYS_TO_VM_PAGE(paddr);
if (!locked)
vm_page_lock_queues();
m->pindex = index;
m->valid = VM_PAGE_BITS_ALL;
m->wire_count = 1;
if (!locked)
vm_page_unlock_queues();
atomic_add_int(&cnt.v_wire_count, 1);
*vap = (vm_offset_t)va;
return (m);