Prefer the use of vm_page_domain() to vm_phys_domain().

When we already have the vm page in hand, use vm_page_domain() instead
of vm_phys_domain().  The former has a trivial constant-time
implementation whereas the latter iterates over the mem_affinity array.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D28005
This commit is contained in:
Alan Cox 2021-01-10 02:51:33 -06:00
parent 0f0379fa55
commit 5a181b8bce

View File

@ -5259,7 +5259,7 @@ get_pv_entry(pmap_t pmap, struct rwlock **lockp)
pc->pc_map[0] = PC_FREE0 & ~1ul; /* preallocated bit 0 */
pc->pc_map[1] = PC_FREE1;
pc->pc_map[2] = PC_FREE2;
pvc = &pv_chunks[vm_phys_domain(m->phys_addr)];
pvc = &pv_chunks[vm_page_domain(m)];
mtx_lock(&pvc->pvc_lock);
TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru);
mtx_unlock(&pvc->pvc_lock);
@ -5360,7 +5360,7 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp)
pc->pc_map[1] = PC_FREE1;
pc->pc_map[2] = PC_FREE2;
TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
TAILQ_INSERT_TAIL(&new_tail[pc_to_domain(pc)], pc, pc_lru);
TAILQ_INSERT_TAIL(&new_tail[vm_page_domain(m)], pc, pc_lru);
PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV));
/*