git: 130374a97b24 - main - uma_core: change listq to plinks.q in temp lists

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Thu, 01 May 2025 06:46:22 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=130374a97b247cf62f64c69d8a570092c42be246

commit 130374a97b247cf62f64c69d8a570092c42be246
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2025-05-01 06:43:49 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2025-05-01 06:43:49 +0000

    uma_core: change listq to plinks.q in temp lists
    
    Change the two functions that use local tailq variables to use the
    plinks.q field, instead of the listq field, for the pointers.
    
    This will resolve one source of conflict when the tailq field and the
    object field come to share the same space in a future change to the
    vm_page definition.
    
    Reviewed by:    alc, kib
    Differential Revision:  https://reviews.freebsd.org/D50094
---
 sys/vm/uma_core.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 61b03ef24925..5189f7405400 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -1986,18 +1986,18 @@ pcpu_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag,
 		}
 		if (__predict_false(p == NULL))
 			goto fail;
-		TAILQ_INSERT_TAIL(&alloctail, p, listq);
+		TAILQ_INSERT_TAIL(&alloctail, p, plinks.q);
 	}
 	if ((addr = kva_alloc(bytes)) == 0)
 		goto fail;
 	zkva = addr;
-	TAILQ_FOREACH(p, &alloctail, listq) {
+	TAILQ_FOREACH(p, &alloctail, plinks.q) {
 		pmap_qenter(zkva, &p, 1);
 		zkva += PAGE_SIZE;
 	}
 	return ((void*)addr);
 fail:
-	TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) {
+	TAILQ_FOREACH_SAFE(p, &alloctail, plinks.q, p_next) {
 		vm_page_unwire_noq(p);
 		vm_page_free(p);
 	}
@@ -2036,11 +2036,7 @@ noobj_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags,
 	while (npages > 0) {
 		p = vm_page_alloc_noobj_domain(domain, req);
 		if (p != NULL) {
-			/*
-			 * Since the page does not belong to an object, its
-			 * listq is unused.
-			 */
-			TAILQ_INSERT_TAIL(&alloctail, p, listq);
+			TAILQ_INSERT_TAIL(&alloctail, p, plinks.q);
 			npages--;
 			continue;
 		}
@@ -2048,7 +2044,7 @@ noobj_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags,
 		 * Page allocation failed, free intermediate pages and
 		 * exit.
 		 */
-		TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) {
+		TAILQ_FOREACH_SAFE(p, &alloctail, plinks.q, p_next) {
 			vm_page_unwire_noq(p);
 			vm_page_free(p); 
 		}
@@ -2058,7 +2054,7 @@ noobj_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *flags,
 	zkva = keg->uk_kva +
 	    atomic_fetchadd_long(&keg->uk_offset, round_page(bytes));
 	retkva = zkva;
-	TAILQ_FOREACH(p, &alloctail, listq) {
+	TAILQ_FOREACH(p, &alloctail, plinks.q) {
 		pmap_qenter(zkva, &p, 1);
 		zkva += PAGE_SIZE;
 	}