git: 11eac05a40a5 - stable/13 - vm: Move the "vm_wait in early boot" assertion to the proper place

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 21 Apr 2022 13:21:16 UTC
The branch stable/13 has been updated by markj:

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

commit 11eac05a40a5b14f65dad67a65aca39f28d969a6
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-14 19:45:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-04-21 13:18:14 +0000

    vm: Move the "vm_wait in early boot" assertion to the proper place
    
    The assertion was added in commit 1771e987ca6a.  After that, vm_wait()
    and friends were refactored such that the actual sleep happens
    elsewhere.  Now the assertion condition is not checked when
    vm_wait_doms() is called directly, and it is checked even if we are not
    going to sleep (because vm_page_count_min_set(wdoms) is false).
    
    Reviewed by:    alc, kib
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 6fb7c42d593d13eba8b72f6cdf434a7cb23fa828)
---
 sys/vm/vm_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 6cdde80bdb8b..d9feba6fe51a 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -3231,6 +3231,8 @@ vm_wait_doms(const domainset_t *wdoms, int mflags)
 		 */
 		mtx_lock(&vm_domainset_lock);
 		if (vm_page_count_min_set(wdoms)) {
+			if (pageproc == NULL)
+				panic("vm_wait in early boot");
 			vm_min_waiters++;
 			error = msleep(&vm_min_domains, &vm_domainset_lock,
 			    PVM | PDROP | mflags, "vmwait", 0);
@@ -3264,8 +3266,6 @@ vm_wait_domain(int domain)
 		} else
 			mtx_unlock(&vm_domainset_lock);
 	} else {
-		if (pageproc == NULL)
-			panic("vm_wait in early boot");
 		DOMAINSET_ZERO(&wdom);
 		DOMAINSET_SET(vmd->vmd_domain, &wdom);
 		vm_wait_doms(&wdom, 0);