aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorFabien Thomas <fabient@FreeBSD.org>2011-03-31 13:59:47 +0000
committerFabien Thomas <fabient@FreeBSD.org>2011-03-31 13:59:47 +0000
commit586cb6ec77ccb471dbb115817a9e39f29dd95ac2 (patch)
treeff69eb812c81c5fd3f17576f198670edff277f82 /sys/kern/sched_ule.c
parenta90dd577e7ae073a94cfe2e94480abb9d4cb7ddc (diff)
downloadsrc-586cb6ec77ccb471dbb115817a9e39f29dd95ac2.tar.gz
src-586cb6ec77ccb471dbb115817a9e39f29dd95ac2.zip
Clearing the flag when preempting will let the preempted thread run
too much time. This can finish in a scheduler deadlock with ping-pong between two threads. One sample of this is: - device lapic (to have a preemption point on critical_exit()) - options DEVICE_POLLING with HZ>1499 (to have lapic freq = hardclock freq) - running a cpu intensive task (that does not enter the kernel) - only one CPU on SMP or no SMP. As requested by jhb@ 4BSD have received the same type of fix instead of propagating the flag to the new thread. Reviewed by: jhb, jeff MFC after: 1 month
Notes
Notes: svn path=/head/; revision=220198
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index c1bb98f7cd9e..ac18e778ae28 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1783,7 +1783,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
ts->ts_rltick = ticks;
td->td_lastcpu = td->td_oncpu;
td->td_oncpu = NOCPU;
- td->td_flags &= ~TDF_NEEDRESCHED;
+ if (!(flags & SW_PREEMPT))
+ td->td_flags &= ~TDF_NEEDRESCHED;
td->td_owepreempt = 0;
tdq->tdq_switchcnt++;
/*