From e97493a743e7df1e7854fbdac61fe77c8d9bc24f Mon Sep 17 00:00:00 2001 From: iedowse Date: Sun, 29 Aug 2004 01:02:33 +0000 Subject: [PATCH] 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 --- sys/vm/vm_zeroidle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index bf0e5f246856..10f78000e812 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -57,9 +57,11 @@ static int cnt_prezero; SYSCTL_INT(_vm_stats_misc, OID_AUTO, cnt_prezero, CTLFLAG_RD, &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, ""); -TUNABLE_INT("vm.idlezero_enable", &idlezero_enable); static int idlezero_maxrun = 16; 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); pri = td->td_priority; mtx_unlock_spin(&sched_lock); + idlezero_enable = idlezero_enable_default; for (;;) { if (vm_page_zero_check()) {