summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2004-08-04 21:49:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2004-08-04 21:49:20 +0000
commitccf71ee5bcc792c009b8dbf0c51f6c02bca9a059 (patch)
tree0391d54fe59e6c1c51369cf7cd71a5a800461e82 /sys/kern/kern_fork.c
parentef68052c976c827bdfedb0eefb04cce7a37af7a7 (diff)
hardclock detects if ITIMER_VIRTUAL and ITIMER_PROF have expired and
sends SIGVTALRM and SIGPROF to the process if they had. There is a big problem with calling psignal from hardclock on MULTIPROCESSOR machines though. It means we need to protect all signal state in the process with a lock because hardclock doesn't obtain KERNEL_LOCK. Trying to track down all the tentacles of this quickly becomes very messy. What saves us at the moment is that SCHED_LOCK (which is used to protect parts of the signal state, but not all) happens to be recursive and forgives small and big errors. That's about to change. So instead of trying to hunt down all the locking problems here, just make hardclock not send signals. Instead hardclock schedules a timeout that will send the signal later. There are many reasons why this works just as good as the previous code, all explained in a comment written in big, friendly letters in kern_clock. miod@ ok noone else dared to ok this, but noone screamed in agony either.
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index ebb7fa5b31d..9d217e76f37 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.70 2004/06/24 19:35:24 tholo Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.71 2004/08/04 21:49:19 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -346,6 +346,9 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
setrunqueue(p2);
SCHED_UNLOCK(s);
+ timeout_set(&p2->p_stats->p_virt_to, virttimer_trampoline, p2);
+ timeout_set(&p2->p_stats->p_prof_to, proftimer_trampoline, p2);
+
/*
* Now can be swapped.
*/