From owner-p4-projects Thu Jun 13 11: 1: 7 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6B5AF37B407; Thu, 13 Jun 2002 11:00:57 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0D06A37B430 for ; Thu, 13 Jun 2002 11:00:55 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5DI0tp46864 for perforce@freebsd.org; Thu, 13 Jun 2002 11:00:55 -0700 (PDT) (envelope-from green@freebsd.org) Date: Thu, 13 Jun 2002 11:00:55 -0700 (PDT) Message-Id: <200206131800.g5DI0tp46864@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to green@freebsd.org using -f From: Brian Feldman Subject: PERFORCE change 12837 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12837 Change 12837 by green@green_laptop_1 on 2002/06/13 11:00:16 Make zombie_thread_lock back into a spin lock and remove the condition where it could sleep; then, make the kernel actually able to boot by adding it to witness's lock order list!!! Affected files ... ... //depot/projects/kse/sys/kern/kern_thread.c#67 edit ... //depot/projects/kse/sys/kern/subr_witness.c#27 edit Differences ... ==== //depot/projects/kse/sys/kern/kern_thread.c#67 (text+ko) ==== @@ -75,7 +75,7 @@ tdlist_head_t zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads); struct mtx zombie_thread_lock; MTX_SYSINIT(zombie_thread_lock, &zombie_thread_lock, - "zombie_thread_lock", MTX_DEF); + "zombie_thread_lock", MTX_SPIN); /* * Pepare a thread for use. @@ -241,9 +241,9 @@ void thread_stash(struct thread *td) { - mtx_lock(&zombie_thread_lock); + mtx_lock_spin(&zombie_thread_lock); TAILQ_INSERT_HEAD(&zombie_threads, td, td_runq); - mtx_unlock(&zombie_thread_lock); + mtx_unlock_spin(&zombie_thread_lock); } /* @@ -252,18 +252,17 @@ void thread_reap(void) { - struct thread *td_reaped, *td_next; + struct thread *td_reaped; - mtx_lock(&zombie_thread_lock); - td_reaped = TAILQ_FIRST(&zombie_threads); - while (td_reaped) { - td_next = TAILQ_NEXT(td_reaped, td_runq); + mtx_lock_spin(&zombie_thread_lock); + while (!TAILQ_EMPTY(&zombie_threads)) { + td_reaped = TAILQ_FIRST(&zombie_threads); TAILQ_REMOVE(&zombie_threads, td_reaped, td_runq); + mtx_unlock_spin(&zombie_thread_lock); thread_free(td_reaped); - td_reaped = td_next; + mtx_lock_spin(&zombie_thread_lock); } - mtx_unlock(&zombie_thread_lock); - + mtx_unlock_spin(&zombie_thread_lock); } /* ==== //depot/projects/kse/sys/kern/subr_witness.c#27 (text+ko) ==== @@ -225,6 +225,7 @@ #endif { "clk", &lock_class_mtx_spin }, { "mutex profiling lock", &lock_class_mtx_spin }, + { "zombie_thread_lock", &lock_class_mtx_spin }, { NULL, NULL }, { NULL, NULL } }; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message