From owner-p4-projects@FreeBSD.ORG Sat Sep 15 21:10:58 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B260B16A41B; Sat, 15 Sep 2007 21:10:58 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 861A616A418 for ; Sat, 15 Sep 2007 21:10:58 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 64A8313C465 for ; Sat, 15 Sep 2007 21:10:58 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l8FLAwK0014374 for ; Sat, 15 Sep 2007 21:10:58 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l8FLAwLI014370 for perforce@freebsd.org; Sat, 15 Sep 2007 21:10:58 GMT (envelope-from kmacy@freebsd.org) Date: Sat, 15 Sep 2007 21:10:58 GMT Message-Id: <200709152110.l8FLAwLI014370@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 126452 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Sep 2007 21:10:59 -0000 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); } /*