git: 4b3c72402e3a - main - vm_object: use iterators in list_handle()

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Thu, 24 Apr 2025 19:22:19 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b3c72402e3a26070d74f230b8c5f9ed3000e423

commit 4b3c72402e3a26070d74f230b8c5f9ed3000e423
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2025-04-24 19:21:23 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2025-04-24 19:21:23 +0000

    vm_object: use iterators in list_handle()
    
    Replace the listq pointers with iterators in vm_object_list_handle().
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D49946
---
 sys/vm/vm_object.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 6a13cc1fd2b5..e1a4143458a3 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2494,6 +2494,7 @@ vm_object_is_active(vm_object_t obj)
 static int
 vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 {
+	struct pctrie_iter pages;
 	struct kinfo_vmobject *kvo;
 	char *fullpath, *freepath;
 	struct vnode *vp;
@@ -2553,7 +2554,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 		kvo->kvo_inactive = 0;
 		kvo->kvo_flags = 0;
 		if (!swap_only) {
-			TAILQ_FOREACH(m, &obj->memq, listq) {
+			vm_page_iter_init(&pages, obj);
+			VM_RADIX_FOREACH(m, &pages) {
 				/*
 				 * A page may belong to the object but be
 				 * dequeued and set to PQ_NONE while the