Lines 26-36
Link Here
|
26 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 |
* SUCH DAMAGE. |
27 |
* SUCH DAMAGE. |
28 |
* |
28 |
* |
29 |
* $FreeBSD$ |
29 |
* $FreeBSD: releng/10.0/sys/kern/kern_racct.c 248298 2013-03-14 23:20:18Z trasz $ |
30 |
*/ |
30 |
*/ |
31 |
|
31 |
|
32 |
#include <sys/cdefs.h> |
32 |
#include <sys/cdefs.h> |
33 |
__FBSDID("$FreeBSD$"); |
33 |
__FBSDID("$FreeBSD: releng/10.0/sys/kern/kern_racct.c 248298 2013-03-14 23:20:18Z trasz $"); |
34 |
|
34 |
|
35 |
#include "opt_kdtrace.h" |
35 |
#include "opt_kdtrace.h" |
36 |
#include "opt_sched.h" |
36 |
#include "opt_sched.h" |
Lines 498-513
Link Here
|
498 |
|
498 |
|
499 |
/* |
499 |
/* |
500 |
* There are some cases where the racct %cpu resource would grow |
500 |
* There are some cases where the racct %cpu resource would grow |
501 |
* beyond 100%. |
501 |
* beyond 100% per core. |
502 |
* For example in racct_proc_exit() we add the process %cpu usage |
502 |
* For example in racct_proc_exit() we add the process %cpu usage |
503 |
* to the ucred racct containers. If too many processes terminated |
503 |
* to the ucred racct containers. If too many processes terminated |
504 |
* in a short time span, the ucred %cpu resource could grow too much. |
504 |
* in a short time span, the ucred %cpu resource could grow too much. |
505 |
* Also, the 4BSD scheduler sometimes returns for a thread more than |
505 |
* Also, the 4BSD scheduler sometimes returns for a thread more than |
506 |
* 100% cpu usage. So we set a boundary here to 100%. |
506 |
* 100% cpu usage. |
|
|
507 |
* So we set a sane boundary here to 100% * the maxumum number of CPUs. |
507 |
*/ |
508 |
*/ |
508 |
if ((resource == RACCT_PCTCPU) && |
509 |
if ((resource == RACCT_PCTCPU) && |
509 |
(racct->r_resources[RACCT_PCTCPU] > 100 * 1000000)) |
510 |
(racct->r_resources[RACCT_PCTCPU] > 100 * 1000000 * (int64_t)MAXCPU)) |
510 |
racct->r_resources[RACCT_PCTCPU] = 100 * 1000000; |
511 |
racct->r_resources[RACCT_PCTCPU] = 100 * 1000000 * (int64_t)MAXCPU; |
511 |
} |
512 |
} |
512 |
|
513 |
|
513 |
static int |
514 |
static int |