summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-06-21 06:28:26 +0000
committertrasz <trasz@FreeBSD.org>2015-06-21 06:28:26 +0000
commite1055c772b450db60c53109ac296de1c9322438d (patch)
treec4fe9dc7d6f9ae04616fa06a004cd2d251b922b7 /sys/kern/subr_trap.c
parent964ee5e924b5e0ab8fa3866fa26b2c4f8642d656 (diff)
downloadFreeBSD-src-e1055c772b450db60c53109ac296de1c9322438d.zip
FreeBSD-src-e1055c772b450db60c53109ac296de1c9322438d.tar.gz
MFC r282213:
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). MFC r282901: Build GENERIC with RACCT/RCTL support by default. Note that it still needs to be enabled by adding "kern.racct.enable=1" to /boot/loader.conf. Note those two are MFC-ed together, because the latter one changes the name of RACCT_DISABLED option to RACCT_DEFAULT_TO_DISABLED. Should have committed the renaming separately... Relnotes: yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 6bef83c..0b5d380b 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <sys/ktr.h>
#include <sys/pioctl.h>
#include <sys/ptrace.h>
+#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/signalvar.h>
@@ -177,11 +178,13 @@ userret(struct thread *td, struct trapframe *frame)
__func__, td, p->p_pid, td->td_name, curvnet,
(td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A"));
#endif
-#ifdef RACCT
- PROC_LOCK(p);
- while (p->p_throttled == 1)
- msleep(p->p_racct, &p->p_mtx, 0, "racct", 0);
- PROC_UNLOCK(p);
+#ifdef RACCT
+ if (racct_enable) {
+ PROC_LOCK(p);
+ while (p->p_throttled == 1)
+ msleep(p->p_racct, &p->p_mtx, 0, "racct", 0);
+ PROC_UNLOCK(p);
+ }
#endif
}
OpenPOWER on IntegriCloud