summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thr.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-07-06 20:06:44 +0000
committertrasz <trasz@FreeBSD.org>2011-07-06 20:06:44 +0000
commit4a17b24427e55ec7e1862b08a0a9247f0717d010 (patch)
tree443d8da9aef22fdf042ab6f2cf16f5e2d4f04bd3 /sys/kern/kern_thr.c
parent1adac93bc0e2f40ac5d98734f9451cb1a0f42124 (diff)
downloadFreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.zip
FreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.tar.gz
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".
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 7011a53..94e41e2 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);
}
OpenPOWER on IntegriCloud