Messages in this thread Patch in this message | | | Date | Fri, 17 Dec 1999 17:12:51 +0100 (CET) | From | Ingo Molnar <> | Subject | [patch] entry.S fix. [was: Re: scheduling problem?] |
| |
On Fri, 17 Dec 1999, William Montgomery wrote:
> [...] however, there is a related > problem which can occur. It is possible for a SCHED_OTHER task > to be running in user mode when a rtc_interrupt occurs which > sends a SIGIO to a SCHED_FIFO task, the SCHED_FIFO task is put > on the run queue and the need_resched flag of the SCHED_OTHER task > is set but the ret_with_resched is not run and the SCHED_OTHER task > can continue for several milliseconds before schedule is run. > > The above scenario can also occur when setitimer is used as a > timing source and a SIGALRM is sent. Maybe we should *always* > run ret_with_resched upon ret_from_intr and not only when in > supervisor mode? Any reasons this would cause problems? > Maybe also after running bottom halfs (in the case of setitimer)?
are you sure you are describing the right scenario? I do not doubt that you see some kind of bug, but detecting ->need_resched == 1 after user-space has been interrupted is fairly common - this is how timer interrupts work.
there is a bug in this area though, we do not re-run the need_resched check _after_ running do_signal(). We always run the check even if user-space is interrupted, but the problem is that it has to be restarted after delivering a signal too. The preliminary fix for this against 2.3.34-pre1 is attached, does it solve your problems? [patch works here just fine]
the fix is a bit subtle, because we must not naively rerun the need_resched-check after do_signal(), because that can cause signal recursion. The patch does it's own, signal-local need_resched check after do_signal. [schedule() runs bottom halves so no need to recheck for bottom halves.]
btw., this patch plus the hlt patch fixes the SysKonnect gigabit ethernet latency fluctuation i've noticed a couple of days ago - now latency over a real gigabit network is stable at 70 microseconds ... [it was fluctuating between 200 and 300 usecs before]
Ingo --- linux/arch/i386/kernel/entry.S.orig Fri Dec 17 07:48:24 1999 +++ linux/arch/i386/kernel/entry.S Fri Dec 17 07:59:45 1999 @@ -222,7 +222,14 @@ jne v86_signal_return xorl %edx,%edx call SYMBOL_NAME(do_signal) - jmp restore_all +signal_resched: + cmpl $0,need_resched(%ebx) + je restore_all + /* + * do not recurse signal handlers. This is the slow path. + */ + call SYMBOL_NAME(schedule) + jmp signal_resched ALIGN v86_signal_return: @@ -230,7 +237,7 @@ movl %eax,%esp xorl %edx,%edx call SYMBOL_NAME(do_signal) - jmp restore_all + jmp signal_resched ALIGN tracesys:
| |