diff options
author | attilio <attilio@FreeBSD.org> | 2007-06-09 18:56:11 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2007-06-09 18:56:11 +0000 |
commit | c105658c88a2c2055d81325040ae51c145564d21 (patch) | |
tree | 5f11084a1ca726fd09afccfce5eb4c0055b06e97 /sys/kern/init_main.c | |
parent | 35719cd36d18abec5f4a2477062825a4a0fe6ead (diff) | |
download | FreeBSD-src-c105658c88a2c2055d81325040ae51c145564d21.zip FreeBSD-src-c105658c88a2c2055d81325040ae51c145564d21.tar.gz |
The current rusage code show peculiar problems:
- Unsafeness on ruadd() in thread_exit()
- Unatomicity of thread_exiit() in the exit1() operations
This patch addresses these problems allocating p_fd as part of the
process and modifying the way it is accessed.
A small chunk of this patch, resolves a race about p_state in kern_wait(),
since we have to be sure about the zombif-ing process.
Submitted by: jeff
Approved by: jeff (mentor)
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index ac00de0..54d78e6 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -500,6 +500,7 @@ proc0_post(void *dummy __unused) { struct timespec ts; struct proc *p; + struct rusage ru; /* * Now we can look at the time, having had a chance to verify the @@ -508,7 +509,11 @@ proc0_post(void *dummy __unused) sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { microuptime(&p->p_stats->p_start); + rufetch(p, &ru); /* Clears thread stats */ p->p_rux.rux_runtime = 0; + p->p_rux.rux_uticks = 0; + p->p_rux.rux_sticks = 0; + p->p_rux.rux_iticks = 0; } sx_sunlock(&allproc_lock); PCPU_SET(switchtime, cpu_ticks()); |