From owner-freebsd-jail@FreeBSD.ORG Fri Apr 24 00:39:05 2009 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 989771065675 for ; Fri, 24 Apr 2009 00:39:05 +0000 (UTC) (envelope-from kagekonjou@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id 53B518FC45 for ; Fri, 24 Apr 2009 00:39:05 +0000 (UTC) (envelope-from kagekonjou@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so508069yxb.13 for ; Thu, 23 Apr 2009 17:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mon4PiziEmwZPnIlIN3s1RJ8y/XxIcXXnDH0hWcAXjI=; b=wOw72i3lWzQGqdSNlkpue9ijGxdCmm3dEV1YBN241pFyBffVoaZJKiqVz17Pn1O7Vz 4LeEQ7i7EHXNd1FHEmkCZCbAxDah0mij0YTzZXm1HQgrwNANLSGY1/utrILfR0zrWgJx gmESEbujKAZSoGoxWosxHqTdVQH2LNNdFJrIM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=EItFdyJrB8U60anvD3L/vL6wJoiHkpKopyxMeQT9eyaoRf4Xu78f7jIk9MHo1/6uHG 9WN8T3FKp4k+4929VQiUGPyGGIKUyJDwFgSxie1bj+2vKggVug1hfhTXL749GJ+sY5pd zYI+1EMlrMqxZOz7THZu7zGBZI86XjMaldNNU= MIME-Version: 1.0 Received: by 10.231.19.68 with SMTP id z4mr841032iba.7.1240531758459; Thu, 23 Apr 2009 17:09:18 -0700 (PDT) In-Reply-To: <49EE42C5.3010409@quip.cz> References: <49EC926D.6020404@peterhost.ru> <49EE42C5.3010409@quip.cz> Date: Thu, 23 Apr 2009 20:09:18 -0400 Message-ID: From: Kage To: Miroslav Lachman <000.fbsd@quip.cz> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable Cc: =?KOI8-R?B?7cXO2NvJy8/XIOvPztPUwc7Uyc4=?= , freebsd-jail@freebsd.org Subject: Re: CPU limit for Jails(patch for ULE scheduler) X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2009 00:39:06 -0000 I'm definitely interested in this patch. I can see some good work coming from this. However, at this time, I do not have a development FreeBSD server I can heavily test this on. I'm definitely looking forward to a "stable" patch of this, and will make use of it. Please keep us informed! 2009/4/21 Miroslav Lachman <000.fbsd@quip.cz>: > =ED=C5=CE=D8=DB=C9=CB=CF=D7 =EB=CF=CE=D3=D4=C1=CE=D4=C9=CE wrote: >> >> Hello all! >> Many users want have limits on resourse for jail, for examle cpu and >> memory limit. >> I`m rewrire original cdjones patch =9Afor cpu limit for jail under ULE >> scheduler. >> So, =9Athis work simple. >> We count cpu usage for all jails, and if jail use cpu more than have >> shared cpu, we move his threads to IDLE queue and return to TIMESHARE in >> =9Areverse case. >> Jailed thread can use all avaliable cpu time, if =9Asystem has avaliable >> cpu. >> If system under heavy load, jailed thread can`t use cpu long as ratio >> (shared cpu for jail/ all shared cpu) < (estimate usage cpu for jail / >> all usage cpu) . >> Unjailed thread and interactive thread are not subject to this regime. >> Add 2 sysctl >> kern.sched.total_sched_shares - total count shares cpu in system, >> increase if we have more cpu >> kern.sched.flush_estcpu_interval - flush estcpu interval in ticks, >> default is 2560 =3D 2 * 128 * 10, NCPU*stathz*sec, increase if we have >> more cpu >> For use cpu limit, you need use flag -S NSharedCPU in /usr/sbin/jail >> program. >> My example jail -S100 /usr/jails/root/ root.kostjn.pht =9A192.168.0.245 >> /bin/csh >> >> I`m tested this under 10 simultaneous process in jail and in main >> system. test program is infinity cycle an 8 core xeon, use RELENG_7. >> First run process in jail, and after in main system. >> This one process tracking cpu usage > > [...] > >> So we see, that after run in main system, jailed process can`t usage cpu= . >> >> Please communicate me =9Aabout all problem in this patch. >> This is initial version, without tune jail parameter in runtime. >> >> So, this work. But i`m not sure, that is best way. >> >> Attempt increase priority for jailed thread not work, because non >> interactive thread (that utilize many cpu) already have small >> prioriry(numerical high). >> Attempt decrease number ticks in cpu time slice, also not good idea, >> because, this increase number context switching on high load. >> May be you see other way for do this? >> Share you idea. >> >> Thank. >> Original cdjones =9Acpu and memory limit patch >> http://wiki.freebsd.org/JailResourceLimits > > Hello, > I can't judge your work / patch as I am not developer nor C programmer. B= ut > it is nice to see that someone is working on the resource limits. I am > waiting for this feature for a years without success. The original SoC > project was never done (not production ready). There were attempts by oth= ers > to update cdjones patch to newer versions of FreeBSD, but still with some > minor problems. The last I remember is "Memory limits on 7.0" by Christop= her > Thunes (e-mail in archive of this list from 2008-06-24). Unfortunately I = had > not time to test his patch in times of 7.0 and I am not aware of any newe= r > version of this patch (for 7.1 or upcoming 7.2). > > It would be nice if independent developers can work together on this subj= ect > and do this work production / commit ready. > > May be you should open PR with you patch, so anybody can find it, test it > and help to make it better. Or if you have own web page with this patch + > some documentation, I can put the link to http://wiki.freebsd.org/Jails > > Can you take a look to Memory limits patch and incorporate it in to your > patch? > > Do you have a plan to add jtune? > > Thanks for your work, I hope I will have time to test it in few weeks. > > Miroslav Lachman > _______________________________________________ > freebsd-jail@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-jail > To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org" > --=20 ~ Kage http://vitund.com http://hackthissite.org