kern/189870: Possible bad CPU resource limit assumption in kern_racct.c

Dustin Wenz dustinwenz at ebureau.com
Fri May 16 20:00:00 UTC 2014


>Number:         189870
>Category:       kern
>Synopsis:       Possible bad CPU resource limit assumption in kern_racct.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 16 20:00:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Dustin Wenz
>Release:        FreeBSD 10.0 r265159
>Organization:
eBureau
>Environment:
FreeBSD ixsys02.office.ebureau.com 10.0-STABLE FreeBSD 10.0-STABLE #2 r265159: Thu May  1 15:07:17 CDT 2014     root at setup.dc.ebureau.com:/usr/obj/usr/src/sys/ALTQKERNEL  amd64
>Description:
I've been having a difficult time using the new CPU percentage limits in FreeBSD 10. It seems that if you specify a limit beyond 110% (say, 500%), the process (or jail, etc.) that you are trying to control becomes unthrottled, and can use the CPU until all logical cores are busy.


>How-To-Repeat:
Run a process that uses 20 cores at 100% utilization (2000%) in total. Attempt to limit that process to only 1000% using rctl.

rctl -a 'process:PID:pcpu:deny=1000/process'

Note that the process is not throttled.
>Fix:
My workaround is to remove these lines in kern_racct.c from function racct_alloc_resource():

if ((resource == RACCT_PCTCPU) &&
    (racct->r_resources[RACCT_PCTCPU] > 100 * 1000000))
   racct->r_resources[RACCT_PCTCPU] = 100 * 1000000;

I'm not sure if there needs to really be any cap on the reported %CPU from the kernel. If so, it should be at least the number of logical cores available * 100 * 1000000.


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list