Date: Wed, 13 Jun 2012 16:42:47 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r237615 - soc2012/rudot/sys/kern Message-ID: <20120613164247.B2D4D106564A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120613164247.B2D4D106564A>
