From owner-freebsd-jail@FreeBSD.ORG Thu Jun 4 05:35:03 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 BE0041065673 for ; Thu, 4 Jun 2009 05:35:03 +0000 (UTC) (envelope-from kostjn@peterhost.ru) Received: from mail.z8.ru (mail.z8.ru [80.93.58.56]) by mx1.freebsd.org (Postfix) with ESMTP id 6D2218FC18 for ; Thu, 4 Jun 2009 05:35:03 +0000 (UTC) (envelope-from kostjn@peterhost.ru) Received: from [85.235.196.139] (helo=kostjn.pht) by mail.z8.ru with esmtpa (Exim 4.67 (FreeBSD)) (envelope-from ) id 1MC5bN-000Fdz-8I for freebsd-jail@freebsd.org; Thu, 04 Jun 2009 09:34:57 +0400 Message-ID: <4A275D80.5050408@peterhost.ru> Date: Thu, 04 Jun 2009 09:37:04 +0400 From: Menshikov Konstantin User-Agent: Thunderbird 2.0.0.18 (X11/20090328) MIME-Version: 1.0 CC: freebsd-jail@freebsd.org References: <20090603180221.E56412@hub.org> In-Reply-To: <20090603180221.E56412@hub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Calculating per jail memory usage ... 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: Thu, 04 Jun 2009 05:35:07 -0000 Marc G. Fournier wrote: > > Are there any tools for this that are either in ports, or others would > like to share? > > ---- > Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) > Email . scrappy@hub.org MSN . > scrappy@hub.org > Yahoo . yscrappy Skype: hub.org ICQ . 7615664 > _______________________________________________ > 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" > Hi. You can consider memory occupied with processes in jail as sum RSS of these processes, but it is wrong. Processes divide memory among themselves, a segment of the text or all memory (if not to do exec after fork). Now in a kernel there is no mechanism with which help it is possible to count a memory size occupied with processes in jail. After this mechanism will appear, it will be possible to add top :) There is a patch for restriction of resources jail, http://wiki.freebsd.org/Jails, CPU + RAM Limits for Current. In it, it is considered memory which is used by processes in jail. Further using a system call jail_get it is possible to receive a memory size used jail. The program jget thus works. Example [root@book /home/kostjn]# ./jget.o 1 Jail limits and rusage, jid = 1 Limits: CPU 5, MEM 64M, NPROC 128, NOFILE 512 Usage: CPU 0, MEM 6M, NPROC 9, NOFILE 65 -- Menshikov Konstantin