Date: Thu, 13 Jun 2002 11:00:55 -0700 (PDT) From: Brian Feldman <green@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 12837 for review Message-ID: <200206131800.g5DI0tp46864@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206131800.g5DI0tp46864>