git: ffca0c44ffe8 - main - vm_object: Export the number of wired pages in vm_object_list_handler()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 10 Oct 2025 13:29:30 UTC
The branch main has been updated by markj:

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

commit ffca0c44ffe84352f6fdd24862c070d348d783d4
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-10-10 13:26:50 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-10-10 13:27:36 +0000

    vm_object: Export the number of wired pages in vm_object_list_handler()
    
    Reviewed by:    alc, kib
    MFC after:      1 week
    Sponsored by:   Modirum MDPay
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D53008
---
 sys/sys/user.h     | 3 ++-
 sys/vm/vm_object.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/sys/user.h b/sys/sys/user.h
index 3183f0792256..1704bc089d85 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -617,7 +617,8 @@ struct kinfo_vmobject {
 	} kvo_type_spec;			/* Type-specific union */
 	uint64_t kvo_me;			/* Uniq handle for anon obj */
 	uint64_t kvo_laundry;			/* Number of laundry pages. */
-	uint64_t _kvo_qspare[5];
+	uint64_t kvo_wired;			/* Number of wired pages. */
+	uint64_t _kvo_qspare[4];
 	uint32_t kvo_swapped;			/* Number of swapped pages */
 	uint32_t kvo_flags;
 	uint32_t _kvo_ispare[6];
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index fe84523b7a8f..5b4517d2bf0c 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2547,6 +2547,9 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 					kvo->kvo_inactive++;
 				else if (vm_page_in_laundry(m))
 					kvo->kvo_laundry++;
+
+				if (vm_page_wired(m))
+					kvo->kvo_wired++;
 			}
 		}