From owner-p4-projects@FreeBSD.ORG Mon Jul 19 01:12:54 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CB7A216A4D0; Mon, 19 Jul 2004 01:12:53 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A629716A4CE for ; Mon, 19 Jul 2004 01:12:53 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8637C43D1F for ; Mon, 19 Jul 2004 01:12:53 +0000 (GMT) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6J1Crnd010559 for ; Mon, 19 Jul 2004 01:12:53 GMT (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6J1Cr1U010556 for perforce@freebsd.org; Mon, 19 Jul 2004 01:12:53 GMT (envelope-from julian@freebsd.org) Date: Mon, 19 Jul 2004 01:12:53 GMT Message-Id: <200407190112.i6J1Cr1U010556@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer To: Perforce Change Reviews Subject: PERFORCE change 57669 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 01:12:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=57669 Change 57669 by julian@julian_desk on 2004/07/19 01:11:56 Catch up with the system version of kern_switch.c. Affected files ... .. //depot/projects/nsched/sys/kern/sched_4bsd.c#27 edit .. //depot/projects/nsched/sys/kern/sched_ule.c#15 edit Differences ... ==== //depot/projects/nsched/sys/kern/sched_4bsd.c#27 (text+ko) ==== @@ -1838,7 +1838,8 @@ ("critical_exit: td_critnest == 0")); if (td->td_critnest == 1) { #ifdef PREEMPTION - if (td->td_flags & TDF_OWEPREEMPT) { + mtx_assert(&sched_lock, MA_NOTOWNED); + if (td->td_pflags & TDP_OWEPREEMPT) { mtx_lock_spin(&sched_lock); mi_switch(SW_INVOL, NULL); mtx_unlock_spin(&sched_lock); @@ -1872,7 +1873,9 @@ * The new thread should not preempt the current thread if any of the * following conditions are true: * - * - The current thread has a higher (numerically lower) priority. + * - The current thread has a higher (numerically lower) or + * equivalent priority. Note that this prevents curthread from + * trying to preempt to itself. * - It is too early in the boot for context switches (cold is set). * - The current thread has an inhibitor set or is in the process of * exiting. In this case, the current thread is about to switch @@ -1902,7 +1905,7 @@ if (ctd->td_critnest > 1) { CTR1(KTR_PROC, "maybe_preempt: in critical section %d", ctd->td_critnest); - ctd->td_flags |= TDF_OWEPREEMPT; + ctd->td_pflags |= TDP_OWEPREEMPT; return (0); } ==== //depot/projects/nsched/sys/kern/sched_ule.c#15 (text+ko) ==== @@ -2780,7 +2780,8 @@ ("critical_exit: td_critnest == 0")); if (td->td_critnest == 1) { #ifdef PREEMPTION - if (td->td_flags & TDF_OWEPREEMPT) { + mtx_assert(&sched_lock, MA_NOTOWNED); + if (td->td_pflags & TDP_OWEPREEMPT) { mtx_lock_spin(&sched_lock); mi_switch(SW_INVOL, NULL); mtx_unlock_spin(&sched_lock); @@ -2815,7 +2816,9 @@ * The new thread should not preempt the current thread if any of the * following conditions are true: * - * - The current thread has a higher (numerically lower) priority. + * - The current thread has a higher (numerically lower) or + * equivalent priority. Note that this prevents curthread from + * trying to preempt to itself. * - It is too early in the boot for context switches (cold is set). * - The current thread has an inhibitor set or is in the process of * exiting. In this case, the current thread is about to switch @@ -2845,7 +2848,7 @@ if (ctd->td_critnest > 1) { CTR1(KTR_PROC, "maybe_preempt: in critical section %d", ctd->td_critnest); - ctd->td_flags |= TDF_OWEPREEMPT; + ctd->td_pflags |= TDP_OWEPREEMPT; return (0); }