aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2011-07-06 20:06:44 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2011-07-06 20:06:44 +0000
commitafcc55f3188a1ccbf11dd648626247308b3bc1a5 (patch)
tree443d8da9aef22fdf042ab6f2cf16f5e2d4f04bd3 /sys/kern/kern_thr.c
parent6765aefcf3c30bb1d385af11d62714f1516380f3 (diff)
downloadsrc-afcc55f3188a1ccbf11dd648626247308b3bc1a5.tar.gz
src-afcc55f3188a1ccbf11dd648626247308b3bc1a5.zip
All the racct_*() calls need to happen with the proc locked. Fixing this
won't happen before 9.0. This commit adds "#ifdef RACCT" around all the "PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order to avoid useless locking/unlocking in kernels built without "options RACCT".
Notes
Notes: svn path=/head/; revision=223825
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r--sys/kern/kern_thr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 7011a53b7cf4..94e41e285ecf 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -185,11 +185,13 @@ create_thread(struct thread *td, mcontext_t *ctx,
}
}
+#ifdef RACCT
PROC_LOCK(td->td_proc);
error = racct_add(p, RACCT_NTHR, 1);
PROC_UNLOCK(td->td_proc);
if (error != 0)
return (EPROCLIM);
+#endif
/* Initialize our td */
newtd = thread_alloc(0);
@@ -277,9 +279,11 @@ create_thread(struct thread *td, mcontext_t *ctx,
return (0);
fail:
+#ifdef RACCT
PROC_LOCK(p);
racct_sub(p, RACCT_NTHR, 1);
PROC_UNLOCK(p);
+#endif
return (error);
}