summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_racct.c24
-rw-r--r--sys/kern/kern_rctl.c12
-rw-r--r--sys/sys/racct.h10
3 files changed, 23 insertions, 23 deletions
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
index 01f7777..d905339 100644
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -173,7 +173,7 @@ racct_sub_racct(struct racct *dest, const struct racct *src)
* Update resource usage in dest.
*/
for (i = 0; i <= RACCT_MAX; i++) {
- if (!racct_is_sloppy(i)) {
+ if (!RACCT_IS_SLOPPY(i)) {
KASSERT(dest->r_resources[i] >= 0,
("racct propagation meltdown: dest < 0"));
KASSERT(src->r_resources[i] >= 0,
@@ -181,10 +181,10 @@ racct_sub_racct(struct racct *dest, const struct racct *src)
KASSERT(src->r_resources[i] <= dest->r_resources[i],
("racct propagation meltdown: src > dest"));
}
- if (racct_is_reclaimable(i)) {
+ if (RACCT_IS_RECLAIMABLE(i)) {
dest->r_resources[i] -= src->r_resources[i];
if (dest->r_resources[i] < 0) {
- KASSERT(racct_is_sloppy(i),
+ KASSERT(RACCT_IS_SLOPPY(i),
("racct_sub_racct: usage < 0"));
dest->r_resources[i] = 0;
}
@@ -218,9 +218,9 @@ racct_destroy_locked(struct racct **racctp)
racct = *racctp;
for (i = 0; i <= RACCT_MAX; i++) {
- if (racct_is_sloppy(i))
+ if (RACCT_IS_SLOPPY(i))
continue;
- if (!racct_is_reclaimable(i))
+ if (!RACCT_IS_RECLAIMABLE(i))
continue;
KASSERT(racct->r_resources[i] == 0,
("destroying non-empty racct: "
@@ -255,7 +255,7 @@ racct_alloc_resource(struct racct *racct, int resource,
racct->r_resources[resource] += amount;
if (racct->r_resources[resource] < 0) {
- KASSERT(racct_is_sloppy(resource),
+ KASSERT(RACCT_IS_SLOPPY(resource),
("racct_alloc_resource: usage < 0"));
racct->r_resources[resource] = 0;
}
@@ -285,7 +285,7 @@ racct_add(struct proc *p, int resource, uint64_t amount)
mtx_lock(&racct_lock);
#ifdef RCTL
error = rctl_enforce(p, resource, amount);
- if (error && racct_is_deniable(resource)) {
+ if (error && RACCT_IS_DENIABLE(resource)) {
SDT_PROBE(racct, kernel, rusage, add_failure, p, resource,
amount, 0, 0);
mtx_unlock(&racct_lock);
@@ -373,14 +373,14 @@ racct_set_locked(struct proc *p, int resource, uint64_t amount)
diff = amount - p->p_racct->r_resources[resource];
#ifdef notyet
- KASSERT(diff >= 0 || racct_is_reclaimable(resource),
+ KASSERT(diff >= 0 || RACCT_IS_RECLAIMABLE(resource),
("racct_set: usage of non-reclaimable resource %d dropping",
resource));
#endif
#ifdef RCTL
if (diff > 0) {
error = rctl_enforce(p, resource, diff);
- if (error && racct_is_deniable(resource)) {
+ if (error && RACCT_IS_DENIABLE(resource)) {
SDT_PROBE(racct, kernel, rusage, set_failure, p,
resource, amount, 0, 0);
return (error);
@@ -489,7 +489,7 @@ racct_sub(struct proc *p, int resource, uint64_t amount)
* We need proc lock to dereference p->p_ucred.
*/
PROC_LOCK_ASSERT(p, MA_OWNED);
- KASSERT(racct_is_reclaimable(resource),
+ KASSERT(RACCT_IS_RECLAIMABLE(resource),
("racct_sub: called for non-reclaimable resource %d", resource));
mtx_lock(&racct_lock);
@@ -512,7 +512,7 @@ racct_sub_cred_locked(struct ucred *cred, int resource, uint64_t amount)
0, 0);
#ifdef notyet
- KASSERT(racct_is_reclaimable(resource),
+ KASSERT(RACCT_IS_RECLAIMABLE(resource),
("racct_sub_cred: called for non-reclaimable resource %d",
resource));
#endif
@@ -564,7 +564,7 @@ racct_proc_fork(struct proc *parent, struct proc *child)
*/
for (i = 0; i <= RACCT_MAX; i++) {
if (parent->p_racct->r_resources[i] == 0 ||
- !racct_is_inheritable(i))
+ !RACCT_IS_INHERITABLE(i))
continue;
error = racct_set_locked(child, i,
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index 3d0a478..5fddbbb 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -907,7 +907,7 @@ rctl_string_to_rule(char *rulestr, struct rctl_rule **rulep)
error = str2int64(amountstr, &rule->rr_amount);
if (error != 0)
goto out;
- if (racct_is_in_thousands(rule->rr_resource))
+ if (RACCT_IS_IN_THOUSANDS(rule->rr_resource))
rule->rr_amount *= 1000;
}
@@ -947,7 +947,7 @@ rctl_rule_add(struct rctl_rule *rule)
/*
* Some rules just don't make sense. Note that the one below
- * cannot be rewritten using racct_is_deniable(); the RACCT_PCTCPU,
+ * cannot be rewritten using RACCT_IS_DENIABLE(); the RACCT_PCTCPU,
* for example, is not deniable in the racct sense, but the
* limit is enforced in a different way, so "deny" rules for %CPU
* do make sense.
@@ -958,7 +958,7 @@ rctl_rule_add(struct rctl_rule *rule)
return (EOPNOTSUPP);
if (rule->rr_per == RCTL_SUBJECT_TYPE_PROCESS &&
- racct_is_sloppy(rule->rr_resource))
+ RACCT_IS_SLOPPY(rule->rr_resource))
return (EOPNOTSUPP);
/*
@@ -1152,7 +1152,7 @@ rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule)
amount = rule->rr_amount;
if (amount != RCTL_AMOUNT_UNDEFINED &&
- racct_is_in_thousands(rule->rr_resource))
+ RACCT_IS_IN_THOUSANDS(rule->rr_resource))
amount /= 1000;
sbuf_printf(sb, "%s:%s=%jd",
@@ -1219,10 +1219,10 @@ rctl_racct_to_sbuf(struct racct *racct, int sloppy)
sb = sbuf_new_auto();
for (i = 0; i <= RACCT_MAX; i++) {
- if (sloppy == 0 && racct_is_sloppy(i))
+ if (sloppy == 0 && RACCT_IS_SLOPPY(i))
continue;
amount = racct->r_resources[i];
- if (racct_is_in_thousands(i))
+ if (RACCT_IS_IN_THOUSANDS(i))
amount /= 1000;
sbuf_printf(sb, "%s=%jd,", rctl_resource_name(i), amount);
}
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 222dbce..9e6907d 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -86,31 +86,31 @@ extern int racct_types[];
* visible to the userland. It gets fixed up when retrieving resource
* usage or adding rules.
*/
-#define racct_is_in_thousands(X) (racct_types[X] & RACCT_IN_THOUSANDS)
+#define RACCT_IS_IN_THOUSANDS(X) (racct_types[X] & RACCT_IN_THOUSANDS)
/*
* Resource usage can drop, as opposed to only grow.
*/
-#define racct_is_reclaimable(X) (racct_types[X] & RACCT_RECLAIMABLE)
+#define RACCT_IS_RECLAIMABLE(X) (racct_types[X] & RACCT_RECLAIMABLE)
/*
* Children inherit resource usage.
*/
-#define racct_is_inheritable(X) (racct_types[X] & RACCT_INHERITABLE)
+#define RACCT_IS_INHERITABLE(X) (racct_types[X] & RACCT_INHERITABLE)
/*
* racct_{add,set}(9) can actually return an error and not update resource
* usage counters. Note that even when resource is not deniable, allocating
* resource might cause signals to be sent by RCTL code.
*/
-#define racct_is_deniable(X) (racct_types[X] & RACCT_DENIABLE)
+#define RACCT_IS_DENIABLE(X) (racct_types[X] & RACCT_DENIABLE)
/*
* Per-process resource usage information makes no sense, but per-credential
* one does. This kind of resources are usually allocated for process, but
* freed using credentials.
*/
-#define racct_is_sloppy(X) (racct_types[X] & RACCT_SLOPPY)
+#define RACCT_IS_SLOPPY(X) (racct_types[X] & RACCT_SLOPPY)
/*
* The 'racct' structure defines resource consumption for a particular
OpenPOWER on IntegriCloud