git: 4876924c0c57 - main - vm_page: fuse two allocation loops

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Fri, 13 Sep 2024 04:43:33 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=4876924c0c57c2255a0e4c254b4054e029e3d884

commit 4876924c0c57c2255a0e4c254b4054e029e3d884
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-09-13 04:41:01 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-09-13 04:41:01 +0000

    vm_page: fuse two allocation loops
    
    Combine two loops, each iterating over the same array of pages to
    initialize them, into a single loop.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D46609
---
 sys/vm/vm_page.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 0f41ea5a6bb5..d21cc38f5e39 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2352,10 +2352,6 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain,
 		if (!vm_domain_alloc_fail(VM_DOMAIN(domain), object, req))
 			return (NULL);
 	}
-	for (m = m_ret; m < &m_ret[npages]; m++) {
-		vm_page_dequeue(m);
-		vm_page_alloc_check(m);
-	}
 
 	/*
 	 * Initialize the pages.  Only the PG_ZERO flag is inherited.
@@ -2376,6 +2372,8 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain,
 	    memattr == VM_MEMATTR_DEFAULT)
 		memattr = object->memattr;
 	for (m = m_ret; m < &m_ret[npages]; m++) {
+		vm_page_dequeue(m);
+		vm_page_alloc_check(m);
 		m->a.flags = 0;
 		m->flags = (m->flags | PG_NODUMP) & flags;
 		m->busy_lock = busy_lock;