Eliminate code duplication in free_pv_entry() and pmap_remove_pages() by
introducing free_pv_chunk().
This commit is contained in:
parent
829ac2c3e0
commit
d85fbe8a91
@ -218,6 +218,7 @@ caddr_t CADDR1 = 0;
|
|||||||
*/
|
*/
|
||||||
static caddr_t crashdumpmap;
|
static caddr_t crashdumpmap;
|
||||||
|
|
||||||
|
static void free_pv_chunk(struct pv_chunk *pc);
|
||||||
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
||||||
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
||||||
static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
|
static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
|
||||||
@ -2174,7 +2175,6 @@ pmap_pv_reclaim(pmap_t locked_pmap)
|
|||||||
static void
|
static void
|
||||||
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
||||||
{
|
{
|
||||||
vm_page_t m;
|
|
||||||
struct pv_chunk *pc;
|
struct pv_chunk *pc;
|
||||||
int idx, field, bit;
|
int idx, field, bit;
|
||||||
|
|
||||||
@ -2198,6 +2198,14 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
|
free_pv_chunk(pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_pv_chunk(struct pv_chunk *pc)
|
||||||
|
{
|
||||||
|
vm_page_t m;
|
||||||
|
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
PV_STAT(pv_entry_spare -= _NPCPV);
|
||||||
PV_STAT(pc_chunk_count--);
|
PV_STAT(pc_chunk_count--);
|
||||||
@ -4211,15 +4219,8 @@ pmap_remove_pages(pmap_t pmap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allfree) {
|
if (allfree) {
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
|
||||||
PV_STAT(pc_chunk_count--);
|
|
||||||
PV_STAT(pc_chunk_frees++);
|
|
||||||
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
free_pv_chunk(pc);
|
||||||
m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
|
|
||||||
dump_drop_page(m->phys_addr);
|
|
||||||
vm_page_unwire(m, 0);
|
|
||||||
vm_page_free(m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pmap_invalidate_all(pmap);
|
pmap_invalidate_all(pmap);
|
||||||
|
@ -286,6 +286,7 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_RD,
|
|||||||
"Number of times pmap_pte_quick didn't change PMAP1");
|
"Number of times pmap_pte_quick didn't change PMAP1");
|
||||||
static struct mtx PMAP2mutex;
|
static struct mtx PMAP2mutex;
|
||||||
|
|
||||||
|
static void free_pv_chunk(struct pv_chunk *pc);
|
||||||
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
||||||
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
||||||
static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
|
static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
|
||||||
@ -2343,7 +2344,6 @@ out:
|
|||||||
static void
|
static void
|
||||||
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
||||||
{
|
{
|
||||||
vm_page_t m;
|
|
||||||
struct pv_chunk *pc;
|
struct pv_chunk *pc;
|
||||||
int idx, field, bit;
|
int idx, field, bit;
|
||||||
|
|
||||||
@ -2364,6 +2364,14 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
|||||||
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
free_pv_chunk(pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_pv_chunk(struct pv_chunk *pc)
|
||||||
|
{
|
||||||
|
vm_page_t m;
|
||||||
|
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
PV_STAT(pv_entry_spare -= _NPCPV);
|
||||||
PV_STAT(pc_chunk_count--);
|
PV_STAT(pc_chunk_count--);
|
||||||
@ -4445,16 +4453,8 @@ pmap_remove_pages(pmap_t pmap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allfree) {
|
if (allfree) {
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
|
||||||
PV_STAT(pc_chunk_count--);
|
|
||||||
PV_STAT(pc_chunk_frees++);
|
|
||||||
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
free_pv_chunk(pc);
|
||||||
m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
|
|
||||||
pmap_qremove((vm_offset_t)pc, 1);
|
|
||||||
vm_page_unwire(m, 0);
|
|
||||||
vm_page_free(m);
|
|
||||||
pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sched_unpin();
|
sched_unpin();
|
||||||
|
@ -277,6 +277,7 @@ SYSCTL_INT(_debug, OID_AUTO, PMAP1unchanged, CTLFLAG_RD,
|
|||||||
"Number of times pmap_pte_quick didn't change PMAP1");
|
"Number of times pmap_pte_quick didn't change PMAP1");
|
||||||
static struct mtx PMAP2mutex;
|
static struct mtx PMAP2mutex;
|
||||||
|
|
||||||
|
static void free_pv_chunk(struct pv_chunk *pc);
|
||||||
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
||||||
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
|
||||||
static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
|
static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
|
||||||
@ -2094,7 +2095,6 @@ out:
|
|||||||
static void
|
static void
|
||||||
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
||||||
{
|
{
|
||||||
vm_page_t m;
|
|
||||||
struct pv_chunk *pc;
|
struct pv_chunk *pc;
|
||||||
int idx, field, bit;
|
int idx, field, bit;
|
||||||
|
|
||||||
@ -2115,6 +2115,14 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv)
|
|||||||
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
free_pv_chunk(pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_pv_chunk(struct pv_chunk *pc)
|
||||||
|
{
|
||||||
|
vm_page_t m;
|
||||||
|
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
PV_STAT(pv_entry_spare -= _NPCPV);
|
||||||
PV_STAT(pc_chunk_count--);
|
PV_STAT(pc_chunk_count--);
|
||||||
@ -3591,16 +3599,8 @@ pmap_remove_pages(pmap_t pmap)
|
|||||||
}
|
}
|
||||||
PT_UPDATES_FLUSH();
|
PT_UPDATES_FLUSH();
|
||||||
if (allfree) {
|
if (allfree) {
|
||||||
PV_STAT(pv_entry_spare -= _NPCPV);
|
|
||||||
PV_STAT(pc_chunk_count--);
|
|
||||||
PV_STAT(pc_chunk_frees++);
|
|
||||||
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
|
||||||
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
|
free_pv_chunk(pc);
|
||||||
m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
|
|
||||||
pmap_qremove((vm_offset_t)pc, 1);
|
|
||||||
vm_page_unwire(m, 0);
|
|
||||||
vm_page_free(m);
|
|
||||||
pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PT_UPDATES_FLUSH();
|
PT_UPDATES_FLUSH();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user