Lines Matching defs:racct
49 #include <sys/racct.h>
68 FEATURE(racct, "Resource Accounting");
80 SYSCTL_NODE(_kern, OID_AUTO, racct, CTLFLAG_RW, 0, "Resource Accounting");
81 TUNABLE_INT("kern.racct.enable", &racct_enable);
96 MTX_SYSINIT(racct_lock, &racct_lock, "racct lock", MTX_DEF);
100 static void racct_sub_racct(struct racct *dest, const struct racct *src);
106 SDT_PROVIDER_DEFINE(racct);
107 SDT_PROBE_DEFINE3(racct, kernel, rusage, add, "struct proc *", "int",
109 SDT_PROBE_DEFINE3(racct, kernel, rusage, add__failure,
111 SDT_PROBE_DEFINE3(racct, kernel, rusage, add__cred, "struct ucred *",
113 SDT_PROBE_DEFINE3(racct, kernel, rusage, add__force, "struct proc *",
115 SDT_PROBE_DEFINE3(racct, kernel, rusage, set, "struct proc *", "int",
117 SDT_PROBE_DEFINE3(racct, kernel, rusage, set__failure,
119 SDT_PROBE_DEFINE3(racct, kernel, rusage, sub, "struct proc *", "int",
121 SDT_PROBE_DEFINE3(racct, kernel, rusage, sub__cred, "struct ucred *",
123 SDT_PROBE_DEFINE1(racct, kernel, racct, create, "struct racct *");
124 SDT_PROBE_DEFINE1(racct, kernel, racct, destroy, "struct racct *");
125 SDT_PROBE_DEFINE2(racct, kernel, racct, join, "struct racct *",
126 "struct racct *");
127 SDT_PROBE_DEFINE2(racct, kernel, racct, join__failure,
128 "struct racct *", "struct racct *");
129 SDT_PROBE_DEFINE2(racct, kernel, racct, leave, "struct racct *",
130 "struct racct *");
305 * They should both calculate in the same way so that the racct %cpu
387 racct_add_racct(struct racct *dest, const struct racct *src)
409 racct_sub_racct(struct racct *dest, const struct racct *src)
444 racct_create(struct racct **racctp)
450 SDT_PROBE(racct, kernel, racct, create, racctp, 0, 0, 0, 0);
452 KASSERT(*racctp == NULL, ("racct already allocated"));
458 racct_destroy_locked(struct racct **racctp)
461 struct racct *racct;
465 SDT_PROBE(racct, kernel, racct, destroy, racctp, 0, 0, 0, 0);
469 KASSERT(*racctp != NULL, ("NULL racct"));
471 racct = *racctp;
478 KASSERT(racct->r_resources[i] == 0,
479 ("destroying non-empty racct: "
481 racct->r_resources[i], i));
483 uma_zfree(racct_zone, racct);
488 racct_destroy(struct racct **racct)
495 racct_destroy_locked(racct);
500 * Increase consumption of 'resource' by 'amount' for 'racct'
505 racct_alloc_resource(struct racct *racct, int resource,
511 KASSERT(racct != NULL, ("NULL racct"));
513 racct->r_resources[resource] += amount;
514 if (racct->r_resources[resource] < 0) {
517 racct->r_resources[resource] = 0;
521 * There are some cases where the racct %cpu resource would grow
524 * to the ucred racct containers. If too many processes terminated
530 (racct->r_resources[RACCT_PCTCPU] > 100 * 1000000))
531 racct->r_resources[RACCT_PCTCPU] = 100 * 1000000;
543 SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0);
553 SDT_PROBE(racct, kernel, rusage, add__failure, p, resource,
589 SDT_PROBE(racct, kernel, rusage, add__cred, cred, resource, amount,
628 SDT_PROBE(racct, kernel, rusage, add__force, p, resource, amount, 0, 0);
652 SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0);
666 * Resources in per-credential racct containers may decay.
669 * old amount that has decayed in the ucred racct containers.
684 SDT_PROBE(racct, kernel, rusage, set__failure, p,
728 SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0);
742 * Resources in per-credential racct containers may decay.
745 * old amount that has decayed in the ucred racct containers.
839 SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0);
866 SDT_PROBE(racct, kernel, rusage, sub__cred, cred, resource, amount,
909 * Create racct for the child process.
1078 racct_move(struct racct *dest, struct racct *src)
1157 racct_decay_resource(struct racct *racct, void * res, void* dummy)
1165 r_old = racct->r_resources[resource];
1173 racct->r_resources[resource] = r_new;
1252 * for %cpu resource only after ucred racct containers have been
1295 racct_zone = uma_zcreate("racct", sizeof(struct racct),
1302 SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init, NULL);
1362 racct_create(struct racct **racctp)
1367 racct_destroy(struct racct **racctp)