Date: Sat, 15 Sep 2007 21:10:58 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126452 for review Message-ID: <200709152110.l8FLAwLI014370@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126452 Change 126452 by kmacy@kmacy_home:ethng on 2007/09/15 21:10:48 replace non inline critical_{enter,exit} with critical_exit_owepreempt Affected files ... .. //depot/projects/ethng/src/sys/kern/kern_switch.c#3 edit Differences ... ==== //depot/projects/ethng/src/sys/kern/kern_switch.c#3 (text+ko) ==== @@ -161,46 +161,15 @@ return (td); } -/* - * Kernel thread preemption implementation. Critical sections mark - * regions of code in which preemptions are not allowed. - */ void -critical_enter(void) +critical_exit_owepreempt(struct thread *td) { - struct thread *td; - - td = curthread; - td->td_critnest++; - CTR4(KTR_CRITICAL, "critical_enter by thread %p (%ld, %s) to %d", td, - (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest); -} - -void -critical_exit(void) -{ - struct thread *td; - - td = curthread; - KASSERT(td->td_critnest != 0, - ("critical_exit: td_critnest == 0")); -#ifdef PREEMPTION - if (td->td_critnest == 1) { - td->td_critnest = 0; - if (td->td_owepreempt) { - td->td_critnest = 1; - thread_lock(td); - td->td_critnest--; - SCHED_STAT_INC(switch_owepreempt); - mi_switch(SW_INVOL|SW_PREEMPT, NULL); - thread_unlock(td); - } - } else -#endif - td->td_critnest--; - - CTR4(KTR_CRITICAL, "critical_exit by thread %p (%ld, %s) to %d", td, - (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest); + td->td_critnest = 1; + thread_lock(td); + td->td_critnest--; + SCHED_STAT_INC(switch_owepreempt); + mi_switch(SW_INVOL|SW_PREEMPT, NULL); + thread_unlock(td); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709152110.l8FLAwLI014370>