Do not sleep in vm_wait() if pagedaemon did not yet started. Panic instead.

Requests which cannot be satisfied by allocators at boot time often
have unrealizable parameters.  Waiting for the pagedaemon' start would
hang the boot if done in the thread0 context and just never succeed if
executed from another thread.  In fact, for very early stages, sleep
attempt panics with obscure diagnostic about the scheduler state, and
explicit panic in vm_wait() makes the investigation much shorter by
cut off the examination of the thread and scheduler.

Theoretically, some subsystem might grab a resource to exhaustion, and
free it later in the boot process.  If this unlikely scenario does
appear for real, the way to diagnose the trouble can be revisited.

Reported by:	emaste
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D8421
This commit is contained in:
Konstantin Belousov 2016-11-04 12:58:50 +00:00
parent 7961a970c7
commit 1771e987ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308288

View file

@ -2738,6 +2738,8 @@ vm_wait(void)
msleep(&vm_pageout_pages_needed, &vm_page_queue_free_mtx,
PDROP | PSWP, "VMWait", 0);
} else {
if (__predict_false(pageproc == NULL))
panic("vm_wait in early boot");
if (!vm_pageout_wanted) {
vm_pageout_wanted = true;
wakeup(&vm_pageout_wanted);