aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/racct.h
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2012-10-26 16:01:08 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2012-10-26 16:01:08 +0000
commit36af98697d92141dcd4f4cca56da38a426ccb089 (patch)
tree842a8cfc3ef8239e42a28dbb369918bc9a00b13e /sys/sys/racct.h
parent6cff4e07c15477db7747f98dc7ecbedfe7563d40 (diff)
downloadsrc-36af98697d92141dcd4f4cca56da38a426ccb089.tar.gz
src-36af98697d92141dcd4f4cca56da38a426ccb089.zip
Add CPU percentage limit enforcement to RCTL. The resouce name is "pcpu".
It was implemented by Rudolf Tomori during Google Summer of Code 2012.
Notes
Notes: svn path=/head/; revision=242139
Diffstat (limited to 'sys/sys/racct.h')
-rw-r--r--sys/sys/racct.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index b4aeee8d21f8..3b34891af14c 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -68,7 +68,8 @@ struct ucred;
#define RACCT_NSHM 17
#define RACCT_SHMSIZE 18
#define RACCT_WALLCLOCK 19
-#define RACCT_MAX RACCT_WALLCLOCK
+#define RACCT_PCTCPU 20
+#define RACCT_MAX RACCT_PCTCPU
/*
* Resource properties.
@@ -78,6 +79,7 @@ struct ucred;
#define RACCT_INHERITABLE 0x04
#define RACCT_DENIABLE 0x08
#define RACCT_SLOPPY 0x10
+#define RACCT_DECAYING 0x20
extern int racct_types[];
@@ -89,7 +91,9 @@ extern int racct_types[];
#define RACCT_IS_IN_MILLIONS(X) (racct_types[X] & RACCT_IN_MILLIONS)
/*
- * Resource usage can drop, as opposed to only grow.
+ * Resource usage can drop, as opposed to only grow. When the process
+ * terminates, its resource usage is freed from the respective
+ * per-credential racct containers.
*/
#define RACCT_IS_RECLAIMABLE(X) (racct_types[X] & RACCT_RECLAIMABLE)
@@ -113,6 +117,20 @@ extern int racct_types[];
#define RACCT_IS_SLOPPY(X) (racct_types[X] & RACCT_SLOPPY)
/*
+ * When a process terminates, its resource usage is not automatically
+ * subtracted from per-credential racct containers. Instead, the resource
+ * usage of per-credential racct containers decays in time.
+ * Resource usage can olso drop for such resource.
+ * So far, the only such resource is RACCT_PCTCPU.
+ */
+#define RACCT_IS_DECAYING(X) (racct_types[X] & RACCT_DECAYING)
+
+/*
+ * Resource usage can drop, as opposed to only grow.
+ */
+#define RACCT_CAN_DROP(X) (RACCT_IS_RECLAIMABLE(X) | RACCT_IS_DECAYING(X))
+
+/*
* The 'racct' structure defines resource consumption for a particular
* subject, such as process or jail.
*