Use vm_page_unwire_noq() instead of directly modifying page wire counts.
No functional change intended. Reviewed by: alc, kib (previous revision) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14266
This commit is contained in:
parent
509f85cf99
commit
ab7c09f121
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329023
@ -2723,8 +2723,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* Have to allocate a new pdp, recurse */
|
||||
if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -2756,8 +2755,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* Have to allocate a new pd, recurse */
|
||||
if (_pmap_allocpte(pmap, NUPDE + pdpindex,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -2770,9 +2768,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* Have to allocate a new pd, recurse */
|
||||
if (_pmap_allocpte(pmap, NUPDE + pdpindex,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count,
|
||||
1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -2904,18 +2900,16 @@ pmap_release(pmap_t pmap)
|
||||
pmap->pm_pml4[DMPML4I + i] = 0;
|
||||
pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */
|
||||
|
||||
m->wire_count--;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
|
||||
if (pmap->pm_pml4u != NULL) {
|
||||
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_pml4u));
|
||||
m->wire_count--;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
kvm_size(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -7711,10 +7705,8 @@ pmap_pti_free_page(vm_page_t m)
|
||||
{
|
||||
|
||||
KASSERT(m->wire_count > 0, ("page %p not wired", m));
|
||||
m->wire_count--;
|
||||
if (m->wire_count != 0)
|
||||
if (!vm_page_unwire_noq(m))
|
||||
return (false);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_free_zero(m);
|
||||
return (true);
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
pa = DMAP_TO_PHYS((vm_offset_t)mem);
|
||||
dump_drop_page(pa);
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
}
|
||||
|
@ -1362,12 +1362,7 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free)
|
||||
}
|
||||
pmap_invalidate_page(pmap, va);
|
||||
|
||||
/*
|
||||
* This is a release store so that the ordinary store unmapping
|
||||
* the page table page is globally performed before TLB shoot-
|
||||
* down is begun.
|
||||
*/
|
||||
atomic_subtract_rel_int(&vm_cnt.v_wire_count, 1);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
|
||||
/*
|
||||
* Put page on a list so that it is released after
|
||||
@ -1493,9 +1488,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* recurse for allocating page dir */
|
||||
if (_pmap_alloc_l3(pmap, NUL2E + NUL1E + l0index,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
/* XXX: release mem barrier? */
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1521,8 +1514,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* recurse for allocating page dir */
|
||||
if (_pmap_alloc_l3(pmap, NUL2E + l1index,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1537,10 +1529,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* recurse for allocating page dir */
|
||||
if (_pmap_alloc_l3(pmap, NUL2E + l1index,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
/* XXX: release mem barrier? */
|
||||
atomic_subtract_int(
|
||||
&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1648,8 +1637,7 @@ pmap_release(pmap_t pmap)
|
||||
|
||||
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l0));
|
||||
|
||||
m->wire_count--;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
pa = DMAP_TO_PHYS((vm_offset_t)mem);
|
||||
dump_drop_page(pa);
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
}
|
||||
|
@ -2057,10 +2057,9 @@ pmap_release(pmap_t pmap)
|
||||
KASSERT(VM_PAGE_TO_PHYS(m) == (pmap->pm_pdpt[i] & PG_FRAME),
|
||||
("pmap_release: got wrong ptd page"));
|
||||
#endif
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
}
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, NPGPTD);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1159,8 +1159,7 @@ _pmap_allocpte(pmap_t pmap, unsigned ptepindex, u_int flags)
|
||||
if (_pmap_allocpte(pmap, NUPDE + segindex,
|
||||
flags) == NULL) {
|
||||
/* alloc failed, release current */
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1238,8 +1237,7 @@ pmap_release(pmap_t pmap)
|
||||
ptdva = (vm_offset_t)pmap->pm_segtab;
|
||||
ptdpg = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS(ptdva));
|
||||
|
||||
ptdpg->wire_count--;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(ptdpg);
|
||||
vm_page_free_zero(ptdpg);
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,6 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
pa = MIPS_DIRECT_TO_PHYS((vm_offset_t)mem);
|
||||
dump_drop_page(pa);
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
(vm_offset_t)mem + PAGE_SIZE);
|
||||
|
||||
m = PHYS_TO_VM_PAGE((vm_offset_t)mem);
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
atomic_subtract_int(&hw_uma_mdpages, 1);
|
||||
}
|
||||
|
@ -1153,12 +1153,7 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free)
|
||||
}
|
||||
pmap_invalidate_page(pmap, va);
|
||||
|
||||
/*
|
||||
* This is a release store so that the ordinary store unmapping
|
||||
* the page table page is globally performed before TLB shoot-
|
||||
* down is begun.
|
||||
*/
|
||||
atomic_subtract_rel_int(&vm_cnt.v_wire_count, 1);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
|
||||
/*
|
||||
* Put page on a list so that it is released after
|
||||
@ -1302,8 +1297,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
|
||||
/* recurse for allocating page dir */
|
||||
if (_pmap_alloc_l3(pmap, NUPDE + l1index,
|
||||
lockp) == NULL) {
|
||||
--m->wire_count;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1388,8 +1382,7 @@ pmap_release(pmap_t pmap)
|
||||
pmap->pm_stats.resident_count));
|
||||
|
||||
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l1));
|
||||
m->wire_count--;
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free_zero(m);
|
||||
|
||||
/* Remove pmap from the allpmaps list */
|
||||
|
@ -429,9 +429,8 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
|
||||
PMAP_STATS_INC(uma_nsmall_free);
|
||||
m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS((vm_offset_t)mem));
|
||||
m->wire_count--;
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user