>Number: 171811 >Category: kern >Synopsis: [patch] rctl(8) cputime is too high >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 20 16:00:22 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Ben Wilber >Release: FreeBSD 10.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD exile 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r240178M: Thu Sep 6 19:25:33 EDT 2012 bw@exodus:/usr/obj/usr/src/sys/COMRADE amd64
>Description: rctl's idea of cputime is unreasonably high with lots of process turnover. >How-To-Repeat: # jail -c command=sh jail# while true; do id > /dev/null; done meanwhile: # dtrace -n 'rusage:add-cred/args[0]->cr_prison->pr_id != 0 && args[1] == 0/{printf("%d: jail %d cputime %d", pid, args[0]->cr_prison->pr_id, args[2])}' 5 57139 rusage:add-cred 37375: jail 5 cputime 124211 5 57139 rusage:add-cred 37375: jail 5 cputime 6330 5 57139 rusage:add-cred 37375: jail 5 cputime 51237828 5 57139 rusage:add-cred 37375: jail 5 cputime 173602 5 57139 rusage:add-cred 37375: jail 5 cputime 6834680 (...) >Fix: Attached patch seems to help. --- kern_racct.diff begins here --- Index: kern_racct.c =================================================================== diff --git a/head/sys/kern/kern_racct.c b/head/sys/kern/kern_racct.c --- a/head/sys/kern/kern_racct.c (revision 240705) +++ b/head/sys/kern/kern_racct.c (working copy) @@ -607,7 +607,9 @@ /* * We don't need to calculate rux, proc_reap() has already done this. */ + PROC_SLOCK(p); runtime = cputick2usec(p->p_rux.rux_runtime); + PROC_SUNLOCK(p); #ifdef notyet KASSERT(runtime >= p->p_prev_runtime, ("runtime < p_prev_runtime")); #else --- kern_racct.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"