socsvn commit: r237615 - soc2012/rudot/sys/kern
rudot at FreeBSD.org
rudot at FreeBSD.org
Wed Jun 13 16:42:49 UTC 2012
Author: rudot
Date: Wed Jun 13 16:42:47 2012
New Revision: 237615
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237615
Log:
per-user %cpu limits. First version - I let the code already present in the racct infrastructure do the work.
Modified:
soc2012/rudot/sys/kern/kern_racct.c
Modified: soc2012/rudot/sys/kern/kern_racct.c
==============================================================================
--- soc2012/rudot/sys/kern/kern_racct.c Wed Jun 13 16:19:20 2012 (r237614)
+++ soc2012/rudot/sys/kern/kern_racct.c Wed Jun 13 16:42:47 2012 (r237615)
@@ -922,7 +922,7 @@
struct timeval wallclock;
uint64_t runtime;
u_int pct;
- uint64_t limit;
+ int error;
for (;;) {
sx_slock(&allproc_lock);
@@ -947,16 +947,10 @@
runtime = p->p_prev_runtime;
#endif
p->p_prev_runtime = runtime;
- limit = racct_get_limit(p, RACCT_PCTCPU);
pct = racct_getpcpu(p);
mtx_lock(&racct_lock);
- /*
- * I use _force_ here because we always want to have
- * the real value in the RACCT_PCTCPU resource
- * regardless of the limits set.
- */
- racct_set_force_locked(p, RACCT_PCTCPU, pct);
- if (pct >= limit) {
+ error = racct_set_locked(p, RACCT_PCTCPU, pct);
+ if (error) {
racct_proc_disable(p);
} else if (racct_proc_disabled(p)) {
racct_proc_enable(p);
More information about the svn-soc-all
mailing list