From owner-svn-src-all@freebsd.org Fri Nov 20 15:13:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27352A3478B; Fri, 20 Nov 2015 15:13:51 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3C8917DF; Fri, 20 Nov 2015 15:13:50 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAKFDnqW019350; Fri, 20 Nov 2015 15:13:49 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAKFDn92019349; Fri, 20 Nov 2015 15:13:49 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201511201513.tAKFDn92019349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Fri, 20 Nov 2015 15:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291100 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 15:13:51 -0000 Author: jpaetzel Date: Fri Nov 20 15:13:49 2015 New Revision: 291100 URL: https://svnweb.freebsd.org/changeset/base/291100 Log: MFC 290662 Fix a bug in the CPU % limiting code If you attempt to set a pcpu limit that is higher than 110% using rctl (for instance, you want a jail to be able to use 2 cores on your system so you set pcpu to 200%) the thing you are trying to limit becomes unthrottled. PR: 189870 Submitted by: dustinwenz@ebureau.com Reviewed by: trasz Modified: stable/10/sys/kern/kern_racct.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_racct.c ============================================================================== --- stable/10/sys/kern/kern_racct.c Fri Nov 20 14:20:24 2015 (r291099) +++ stable/10/sys/kern/kern_racct.c Fri Nov 20 15:13:49 2015 (r291100) @@ -519,16 +519,16 @@ racct_adjust_resource(struct racct *racc /* * There are some cases where the racct %cpu resource would grow - * beyond 100%. - * For example in racct_proc_exit() we add the process %cpu usage - * to the ucred racct containers. If too many processes terminated - * in a short time span, the ucred %cpu resource could grow too much. - * Also, the 4BSD scheduler sometimes returns for a thread more than - * 100% cpu usage. So we set a boundary here to 100%. + * beyond 100% per core. For example in racct_proc_exit() we add + * the process %cpu usage to the ucred racct containers. If too + * many processes terminated in a short time span, the ucred %cpu + * resource could grow too much. Also, the 4BSD scheduler sometimes + * returns for a thread more than 100% cpu usage. So we set a sane + * boundary here to 100% * the maxumum number of CPUs. */ if ((resource == RACCT_PCTCPU) && - (racct->r_resources[RACCT_PCTCPU] > 100 * 1000000)) - racct->r_resources[RACCT_PCTCPU] = 100 * 1000000; + (racct->r_resources[RACCT_PCTCPU] > 100 * 1000000 * (int64_t)MAXCPU)) + racct->r_resources[RACCT_PCTCPU] = 100 * 1000000 * (int64_t)MAXCPU; } static int