git: 9b42b9863808 - stable/14 - vm_object: Report laundry pages in kinfo_vmobject

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 29 Oct 2024 13:34:16 UTC
The branch stable/14 has been updated by markj:

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

commit 9b42b9863808791a24ed77e80c5d64ab47211019
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-22 12:47:52 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-29 13:04:25 +0000

    vm_object: Report laundry pages in kinfo_vmobject
    
    Reviewed by:    bnovkov, kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D47214
    
    (cherry picked from commit a86373bc93ee1c850943e8585d0d426479378145)
---
 sys/sys/user.h     | 3 ++-
 sys/vm/vm_object.c | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/sys/user.h b/sys/sys/user.h
index 945a51f6c3de..7e4ab5bd914f 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -607,7 +607,8 @@ struct kinfo_vmobject {
 		uint64_t _kvo_backing_obj;	/* Handle for the backing obj */
 	} kvo_type_spec;			/* Type-specific union */
 	uint64_t kvo_me;			/* Uniq handle for anon obj */
-	uint64_t _kvo_qspare[6];
+	uint64_t kvo_laundry;			/* Number of laundry pages. */
+	uint64_t _kvo_qspare[5];
 	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 d2ac8f696634..06dae7de3baa 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2583,10 +2583,12 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 				 * sysctl is only meant to give an
 				 * approximation of the system anyway.
 				 */
-				if (m->a.queue == PQ_ACTIVE)
+				if (vm_page_active(m))
 					kvo->kvo_active++;
-				else if (m->a.queue == PQ_INACTIVE)
+				else if (vm_page_inactive(m))
 					kvo->kvo_inactive++;
+				else if (vm_page_in_laundry(m))
+					kvo->kvo_laundry++;
 			}
 		}