kern/189870: Possible bad CPU resource limit assumption in kern_racct.c
dustinwenz at ebureau.com
Fri May 16 20:00:00 UTC 2014
>Synopsis: Possible bad CPU resource limit assumption in kern_racct.c
>Arrival-Date: Fri May 16 20:00:00 UTC 2014
>Originator: Dustin Wenz
>Release: FreeBSD 10.0 r265159
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
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.
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.
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.
More information about the freebsd-bugs