From owner-freebsd-hackers Tue Feb 18 17: 6:59 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0CCD537B405 for ; Tue, 18 Feb 2003 17:06:58 -0800 (PST) Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 822A843FAF for ; Tue, 18 Feb 2003 17:06:56 -0800 (PST) (envelope-from mooneer@translator.cx) Received: from pool0684.cvx31-bradley.dialup.earthlink.net ([209.179.148.174] helo=morpheus) by gull.mail.pas.earthlink.net with smtp (Exim 3.33 #1) id 18lIhL-0006IW-00 for freebsd-hackers@freebsd.org; Tue, 18 Feb 2003 17:06:55 -0800 From: "Mooneer Salem" To: "FreeBSD Hackers" Subject: Per-jail CPU limits? Date: Tue, 18 Feb 2003 17:06:49 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, I've been looking at the kernel source, in particular the scheduler in the past few weeks. I found a place in kern_switch.c where per-jail CPU controls could be added (in particular, in the kse_reassign() function). From looking at that function, I could loop through td_runq until I either: 1. Found a thread that isn't jailed, 2. Found a jailed thread, but determine it's safe to let it run because it does not go over sysctl-defined limits, or 3. Find no usable thread, in which case the KSE would theoretically switch over to the idle process until it's time to repeat the process again. This should allow the use of the standard FreeBSD scheduler, except for the jail limits. The question is, how do we determine the total CPU used by the jail? I found the kg_estcpu entry in struct ksegrp, which the thread has a pointer to, but would that be enough? Is there a different approach we could take that would solve this problem? Thanks, -- Mooneer Salem GPLTrans: http://www.translator.cx/ lifeafterking.org: http://www.lifeafterking.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message