git: 5fc343791566 - main - vm_object: Assert that managed pages are on pagequeues when freeing

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 21 Oct 2024 13:33:14 UTC
The branch main has been updated by markj:

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

commit 5fc34379156678ccfd0b4fe0ca4397b420174236
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-21 13:25:21 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-21 13:25:53 +0000

    vm_object: Assert that managed pages are on pagequeues when freeing
    
    Reviewed by:    dougm, kib
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D46945
---
 sys/vm/vm_object.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 83d6b709e277..5ce21a683541 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -895,6 +895,9 @@ vm_object_terminate_single_page(vm_page_t p, void *objectv)
 	    ("%s: page %p is inconsistent", __func__, p));
 	p->object = NULL;
 	if (vm_page_drop(p, VPRC_OBJREF) == VPRC_OBJREF) {
+		KASSERT((object->flags & OBJ_UNMANAGED) != 0 ||
+		    vm_page_astate_load(p).queue != PQ_NONE,
+		    ("%s: page %p does not belong to a queue", __func__, p));
 		VM_CNT_INC(v_pfree);
 		vm_page_free(p);
 	}