PERFORCE change 126452 for review

Kip Macy kmacy at FreeBSD.org
Sat Sep 15 14:10:59 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126452

Change 126452 by kmacy at 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);
 }
 
 /*


More information about the p4-projects mailing list