Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2025 08:20:21 GMT
From:      Doug Moore <dougm@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7c9fe7a7925b - main - vm_page: remove obsolete page alloc loops
Message-ID:  <202505160820.54G8KLtX075390@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=7c9fe7a7925b8f60e056628fceaaf5f1a969fff4

commit 7c9fe7a7925b8f60e056628fceaaf5f1a969fff4
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2025-05-16 08:05:40 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2025-05-16 08:05:40 +0000

    vm_page: remove obsolete page alloc loops
    
    When page_alloc_noobj functions were introduced, the need for loops to
    support cycles of try-alloc, then wait, then retry disppeared from
    vm_page_alloc_domain and vm_page_alloc_contig_domain functions, but
    loops remained.  Remove them.
    
    Reported by:    alc
    Reviewed by:    alc, markj, kib
    Differential Revision:  https://reviews.freebsd.org/D50263
---
 sys/vm/vm_page.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 035b144ccd1e..f83df515a03d 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2140,8 +2140,6 @@ again:
 		 * Not allocatable, give up.
 		 */
 		pctrie_iter_reset(pages);
-		if (vm_domain_alloc_fail(vmd, object, req))
-			goto again;
 		return (NULL);
 	}
 
@@ -2333,23 +2331,23 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain,
 	KASSERT(npages > 0, ("vm_page_alloc_contig: npages is zero"));
 
 	vm_page_iter_init(&pages, object);
-	for (;;) {
+	m_ret = NULL;
 #if VM_NRESERVLEVEL > 0
-		/*
-		 * Can we allocate the pages from a reservation?
-		 */
-		if (vm_object_reserv(object) &&
-		    (m_ret = vm_reserv_alloc_contig(object, pindex, domain,
-		    req, npages, low, high, alignment, boundary, &pages)) !=
-		    NULL) {
-			break;
-		}
+	/*
+	 * Can we allocate the pages from a reservation?
+	 */
+	if (vm_object_reserv(object)) {
+		m_ret = vm_reserv_alloc_contig(object, pindex, domain,
+		    req, npages, low, high, alignment, boundary, &pages);
+	}
 #endif
-		if ((m_ret = vm_page_find_contig_domain(domain, req, npages,
-		    low, high, alignment, boundary)) != NULL)
-			break;
-		if (!vm_domain_alloc_fail(VM_DOMAIN(domain), object, req))
-			return (NULL);
+	if (m_ret == NULL) {
+		m_ret = vm_page_find_contig_domain(domain, req, npages,
+		    low, high, alignment, boundary);
+	}
+	if (m_ret == NULL) {
+		(void)vm_domain_alloc_fail(VM_DOMAIN(domain), object, req);
+		return (NULL);
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505160820.54G8KLtX075390>