PERFORCE change 57669 for review
Julian Elischer
julian at FreeBSD.org
Sun Jul 18 18:12:54 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=57669
Change 57669 by julian at 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);
}
More information about the p4-projects
mailing list