diff options
author | trasz <trasz@FreeBSD.org> | 2015-04-29 10:23:02 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2015-04-29 10:23:02 +0000 |
commit | 802017a04b7fb1bc31576aa2de108cf67083c42c (patch) | |
tree | 59650c7275c65023f54e8bff435945b07bc2714a /sys/kern/kern_thr.c | |
parent | 0b81a496572c1f07b5403b35bdf7d54c37e4367e (diff) | |
download | FreeBSD-src-802017a04b7fb1bc31576aa2de108cf67083c42c.zip FreeBSD-src-802017a04b7fb1bc31576aa2de108cf67083c42c.tar.gz |
Add kern.racct.enable tunable and RACCT_DISABLED config option.
The point of this is to be able to add RACCT (with RACCT_DISABLED)
to GENERIC, to avoid having to rebuild the kernel to use rctl(8).
Differential Revision: https://reviews.freebsd.org/D2369
Reviewed by: kib@
MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r-- | sys/kern/kern_thr.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index d5f1ce6..6911bb97 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -187,11 +187,13 @@ create_thread(struct thread *td, mcontext_t *ctx, } #ifdef RACCT - PROC_LOCK(p); - error = racct_add(p, RACCT_NTHR, 1); - PROC_UNLOCK(p); - if (error != 0) - return (EPROCLIM); + if (racct_enable) { + PROC_LOCK(p); + error = racct_add(p, RACCT_NTHR, 1); + PROC_UNLOCK(p); + if (error != 0) + return (EPROCLIM); + } #endif /* Initialize our td */ @@ -280,9 +282,11 @@ create_thread(struct thread *td, mcontext_t *ctx, fail: #ifdef RACCT - PROC_LOCK(p); - racct_sub(p, RACCT_NTHR, 1); - PROC_UNLOCK(p); + if (racct_enable) { + PROC_LOCK(p); + racct_sub(p, RACCT_NTHR, 1); + PROC_UNLOCK(p); + } #endif return (error); } |