git: 5a181b8bce99 - main - Prefer the use of vm_page_domain() to vm_phys_domain().

Alan Cox alc at FreeBSD.org
Sun Jan 10 19:29:15 UTC 2021


The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a181b8bce9958be9e3c2b3840f5a56b712c108e

commit 5a181b8bce9958be9e3c2b3840f5a56b712c108e
Author:     Alan Cox <alc at FreeBSD.org>
AuthorDate: 2021-01-10 08:51:33 +0000
Commit:     Alan Cox <alc at FreeBSD.org>
CommitDate: 2021-01-10 19:25:33 +0000

    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
---
 sys/amd64/amd64/pmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 5267203d7473..2ec303d687a7 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -5259,7 +5259,7 @@ retry:
 	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 @@ retry:
 		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));
 
 		/*


More information about the dev-commits-src-all mailing list