diff options
author | bde <bde@FreeBSD.org> | 2001-02-19 09:40:58 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2001-02-19 09:40:58 +0000 |
commit | 3941e240951610fbcc5ea014546b44ef58f5a653 (patch) | |
tree | 1ef084ce9a834e08901e5a1c6da8a628ea189f0b | |
parent | e4a32d70409e6e91e0c40ff94ad122adcbf9cb87 (diff) | |
download | FreeBSD-src-3941e240951610fbcc5ea014546b44ef58f5a653.zip FreeBSD-src-3941e240951610fbcc5ea014546b44ef58f5a653.tar.gz |
Fixed a longstanding latency bug in signal delivery. When a signal
is sent to a process, psignal() needs to schedule an AST for the
process if the process is runnable, not just if it is current, so that
pending signals get checked for on the next return of the process to
user mode. This wasn't practical until recently because the AST flag
was per-cpu so setting it for a non-current process would usually just
cause a bogus AST for the current process.
For non-current processes looping in user mode, it took accidental
(?) magic to deliver signals at all. Signals were usually delivered
late as a side effect of rescheduling (need_resched() sets astpending,
etc.). In pre-SMPng, delivery was delayed by at most 1 quantum (the
need_resched() call in roundrobin() is certain to occur within 1
quantum for looping processes). In -current, things are complicated
by normal interrupt handlers being threads. Missing handling of the
complications makes roundrobin() a bogus no-op, but preemptive
scheduling sort of works anyway due to even larger bogons elsewhere.
-rw-r--r-- | sys/kern/kern_sig.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ebe8852..3be205c 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1250,17 +1250,13 @@ psignal(p, sig) * other than kicking ourselves if we are running. * It will either never be noticed, or noticed very soon. */ - if (p == curproc) { + if (p->p_stat == SRUN) { signotify(p); mtx_unlock_spin(&sched_lock); - } #ifdef SMP - else if (p->p_stat == SRUN) { - mtx_unlock_spin(&sched_lock); forward_signal(p); - } #endif - else + } else mtx_unlock_spin(&sched_lock); goto out; } |