git: 149e1af6ae49 - main - vm_kern: Use VM_ALLOC_NOFREE when allocating 'zero_region' page

From: Bojan Novković <bnovkov_at_FreeBSD.org>
Date: Sat, 05 Oct 2024 15:08:33 UTC
The branch main has been updated by bnovkov:

URL: https://cgit.FreeBSD.org/src/commit/?id=149e1af6ae4936fac0a907d4c62d745c179b4dc5

commit 149e1af6ae4936fac0a907d4c62d745c179b4dc5
Author:     Bojan Novković <bnovkov@FreeBSD.org>
AuthorDate: 2024-10-05 15:05:40 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2024-10-05 15:05:40 +0000

     vm_kern: Use VM_ALLOC_NOFREE when allocating 'zero_region' page
    
     Allocate the 'zero_region' page using VM_ALLOC_NOFREE since
     it never gets released.
    
     Differential Revision:  https://reviews.freebsd.org/D46885
     Reviewed by:    alc, markj, kib
---
 sys/vm/vm_kern.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index fb7c80b767ed..22776e2196b0 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -762,7 +762,8 @@ kmem_init_zero_region(void)
 	 * zeros, while not using much more physical resources.
 	 */
 	addr = kva_alloc(ZERO_REGION_SIZE);
-	m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO);
+	m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO |
+	    VM_ALLOC_NOFREE);
 	for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE)
 		pmap_qenter(addr + i, &m, 1);
 	pmap_protect(kernel_pmap, addr, addr + ZERO_REGION_SIZE, VM_PROT_READ);