From owner-freebsd-fs@FreeBSD.ORG Thu May 17 11:34:01 2007 Return-Path: X-Original-To: fs@freebsd.org Delivered-To: freebsd-fs@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C86F116A479 for ; Thu, 17 May 2007 11:34:01 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from mh2.centtech.com (moat3.centtech.com [64.129.166.50]) by mx1.freebsd.org (Postfix) with ESMTP id 93E9F13C465 for ; Thu, 17 May 2007 11:34:01 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from neutrino.centtech.com (neutrino.centtech.com [10.177.171.220]) by mh2.centtech.com (8.13.8/8.13.8) with ESMTP id l4HBXx76038418; Thu, 17 May 2007 06:33:59 -0500 (CDT) (envelope-from anderson@freebsd.org) Message-ID: <464C3DA7.3020003@freebsd.org> Date: Thu, 17 May 2007 06:33:59 -0500 From: Eric Anderson User-Agent: Thunderbird 2.0.0.0 (X11/20070420) MIME-Version: 1.0 To: Howard Su References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.88.4/3264/Wed May 16 15:43:07 2007 on mh2.centtech.com X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=8.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.6 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on mh2.centtech.com Cc: fs@freebsd.org Subject: Re: size limit for TMPFS X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2007 11:34:01 -0000 On 05/17/07 04:36, Howard Su wrote: > In current implementation of tmpfs, the size limit of a tmpfs (which > is passed when mounting) only count the file size. The memory used for > directories is not limit. This due to the fact that there is not easy > and fast way to track a uma_zone's memory usage. > > there are several approach: > 1. hack vm to support a hook when uma_zone allocate a new page. this > approach comes from Rohit Jalan. This also need some new API in uma(9) > uma_set_allocate_hook > uma_set_deallocate_hook > > > 2. Add a new API to uma(9) to report its memory usage. This will > require traveling a link list inside uma_zone. > uma_get_paged > > 3. Guess a file number limit based on size if use doesn't specific > explict, or get the number user sepcified. Use the number limit > instead of size limit to limit the memory usage. This doesn't need any > changes to uma. Also the implementation is clean. > > I personally perfer way 3. Any suggestions? > Track the memory usage on your own? As you allocate, keep a counter and total up the usage outside of uma. (3) sounds good, except it may not be accurate, and that could lead to confusion for someone. Eric