git: 27d5df7c26c2 - stable/15 - vm_fault: assert that first_m is xbusy

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 11 Oct 2025 05:08:39 UTC
The branch stable/15 has been updated by kib:

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

commit 27d5df7c26c24ca63996ae1582dcbe7fbc167448
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-08-05 15:46:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-10-11 05:08:13 +0000

    vm_fault: assert that first_m is xbusy
    
    (cherry picked from commit a38483fa2b3a26414d3409b12dd35ac406c44cea)
---
 sys/vm/vm_fault.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 859b1f9e1a94..dfd711ca93ea 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1802,6 +1802,11 @@ found:
 	/*
 	 * A valid page has been found and busied.  The object lock
 	 * must no longer be held if the page was busied.
+	 *
+	 * Regardless of the busy state of fs.m, fs.first_m is always
+	 * exclusively busied after the first iteration of the loop
+	 * calling vm_fault_object().  This is an ordering point for
+	 * the parallel faults occuring in on the same page.
 	 */
 	vm_page_assert_busied(fs.m);
 	VM_OBJECT_ASSERT_UNLOCKED(fs.object);
@@ -1904,6 +1909,9 @@ found:
 		(*fs.m_hold) = fs.m;
 		vm_page_wire(fs.m);
 	}
+
+	KASSERT(fs.first_object == fs.object || vm_page_xbusied(fs.first_m),
+	    ("first_m must be xbusy"));
 	if (vm_page_xbusied(fs.m))
 		vm_page_xunbusy(fs.m);
 	else