Prevent vm_page_zero_idle_wakeup() from attempting to wake up the

page zeroing thread before it has been created. It was possible for
calls to free() very early in the boot process to panic here because
the sleep queues were not yet initialised. Specifically, sysinit_add()
running at SI_SUB_KLD would trigger this if the array of pointers
became big enough to require uma_large_alloc() allocations.

Submitted by:	peter
This commit is contained in:
iedowse 2004-08-29 01:02:33 +00:00
parent 0d52a8d8ca
commit e97493a743

View File

@ -57,9 +57,11 @@ static int cnt_prezero;
SYSCTL_INT(_vm_stats_misc, OID_AUTO, cnt_prezero, CTLFLAG_RD, SYSCTL_INT(_vm_stats_misc, OID_AUTO, cnt_prezero, CTLFLAG_RD,
&cnt_prezero, 0, ""); &cnt_prezero, 0, "");
static int idlezero_enable = 1; static int idlezero_enable_default = 1;
TUNABLE_INT("vm.idlezero_enable", &idlezero_enable_default);
/* Defer setting the enable flag until the kthread is running. */
static int idlezero_enable = 0;
SYSCTL_INT(_vm, OID_AUTO, idlezero_enable, CTLFLAG_RW, &idlezero_enable, 0, ""); SYSCTL_INT(_vm, OID_AUTO, idlezero_enable, CTLFLAG_RW, &idlezero_enable, 0, "");
TUNABLE_INT("vm.idlezero_enable", &idlezero_enable);
static int idlezero_maxrun = 16; static int idlezero_maxrun = 16;
SYSCTL_INT(_vm, OID_AUTO, idlezero_maxrun, CTLFLAG_RW, &idlezero_maxrun, 0, ""); SYSCTL_INT(_vm, OID_AUTO, idlezero_maxrun, CTLFLAG_RW, &idlezero_maxrun, 0, "");
@ -147,6 +149,7 @@ vm_pagezero(void __unused *arg)
rtp_to_pri(&rtp, td->td_ksegrp); rtp_to_pri(&rtp, td->td_ksegrp);
pri = td->td_priority; pri = td->td_priority;
mtx_unlock_spin(&sched_lock); mtx_unlock_spin(&sched_lock);
idlezero_enable = idlezero_enable_default;
for (;;) { for (;;) {
if (vm_page_zero_check()) { if (vm_page_zero_check()) {