git: 69ccea1c89da - main - vm_page: Let vm_page_init_page() take a pool parameter

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 14 Jun 2024 01:21:15 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=69ccea1c89da82cbb772ac4cca62c1067346fe95

commit 69ccea1c89da82cbb772ac4cca62c1067346fe95
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-14 00:11:03 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-14 01:18:59 +0000

    vm_page: Let vm_page_init_page() take a pool parameter
    
    This is useful for a subsequent patch which implements lazy
    initialization of vm_page structures using a dedicate vm_phys free page
    pool.
    
    No functional change intended.
    
    Reviewed by:    alc, kib, emaste
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D40399
---
 sys/amd64/amd64/efirt_machdep.c |  3 ++-
 sys/vm/vm_page.c                | 10 +++++-----
 sys/vm/vm_page.h                |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c
index 5d0106e2aa88..2c00a16b1499 100644
--- a/sys/amd64/amd64/efirt_machdep.c
+++ b/sys/amd64/amd64/efirt_machdep.c
@@ -245,7 +245,8 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz)
 
 			m = PHYS_TO_VM_PAGE(va);
 			if (m != NULL && VM_PAGE_TO_PHYS(m) == 0) {
-				vm_page_init_page(m, va, -1);
+				vm_page_init_page(m, va, -1,
+				    VM_FREEPOOL_DEFAULT);
 				m->order = VM_NFREEORDER + 1; /* invalid */
 				m->pool = VM_NFREEPOOL + 1; /* invalid */
 				pmap_page_set_memattr_noflush(m, mode);
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 4b97637668b4..3077b023754a 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -497,9 +497,8 @@ vm_page_domain_init(int domain)
  * lists.
  */
 void
-vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind)
+vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind, int pool)
 {
-
 	m->object = NULL;
 	m->ref_count = 0;
 	m->busy_lock = VPB_FREED;
@@ -509,7 +508,7 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind)
 	m->psind = 0;
 	m->segind = segind;
 	m->order = VM_NFREEORDER;
-	m->pool = VM_FREEPOOL_DEFAULT;
+	m->pool = pool;
 	m->valid = m->dirty = 0;
 	pmap_page_init(m);
 }
@@ -756,7 +755,8 @@ vm_page_startup(vm_offset_t vaddr)
 #if defined(__i386__) && defined(VM_PHYSSEG_DENSE)
 	for (ii = 0; ii < vm_page_array_size; ii++) {
 		m = &vm_page_array[ii];
-		vm_page_init_page(m, (first_page + ii) << PAGE_SHIFT, 0);
+		vm_page_init_page(m, (first_page + ii) << PAGE_SHIFT, 0,
+		    VM_FREEPOOL_DEFAULT);
 		m->flags = PG_FICTITIOUS;
 	}
 #endif
@@ -765,7 +765,7 @@ vm_page_startup(vm_offset_t vaddr)
 		seg = &vm_phys_segs[segind];
 		for (m = seg->first_page, pa = seg->start; pa < seg->end;
 		    m++, pa += PAGE_SIZE)
-			vm_page_init_page(m, pa, segind);
+			vm_page_init_page(m, pa, segind, VM_FREEPOOL_DEFAULT);
 
 		/*
 		 * Add the segment's pages that are covered by one of
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 221f58b8fb04..5422f8df89a0 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -645,7 +645,7 @@ void vm_page_free_invalid(vm_page_t);
 vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);
 void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);
 void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags);
-void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind);
+void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind, int pool);
 int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
 void vm_page_invalid(vm_page_t m);
 void vm_page_launder(vm_page_t m);