# Bad CPU resource limit assumption in kern_racct.c?



## DecimalD (May 14, 2014)

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.

On a whim, I commented out these lines in kern_racct.c (racct_alloc_resource()):

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

After rebuilding the kernel, it appears that I can throttle based on any arbitrary percentage.

Would anyone more familiar with the RACCT code care to comment on the safety of this modification?


----------

