From owner-freebsd-arch@FreeBSD.ORG Wed Jul 28 04:26:46 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3987316A535 for ; Wed, 28 Jul 2004 04:26:46 +0000 (GMT) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id E992A43D45 for ; Wed, 28 Jul 2004 04:26:45 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 30717 invoked from network); 28 Jul 2004 04:26:45 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 28 Jul 2004 04:26:45 -0000 Received: from slimer.baldwin.cx (slimer.baldwin.cx [192.168.0.16]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i6S4QMKi076150; Wed, 28 Jul 2004 00:26:42 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-arch@FreeBSD.org Date: Tue, 27 Jul 2004 21:20:48 -0400 User-Agent: KMail/1.6 References: <200407221502.i6MF2Yqg039032@freefall.freebsd.org> <40FFFBA3.1030204@elischer.org> In-Reply-To: <40FFFBA3.1030204@elischer.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200407272120.48608.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: arch@FreeBSD.org cc: Julian Elischer cc: Poul-Henning Kamp Subject: Re: [REVIEW] unit number allocation API X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2004 04:26:46 -0000 On Thursday 22 July 2004 01:38 pm, Julian Elischer wrote: > Poul-Henning Kamp wrote: > >We need to allocate unit numbers for (pseudo)devices, and a few > >places we need to allocate inode numbers for synthetic filesystems > >(for instance DEVFS). > > > >For these applications the overhead of rman(9) can be totally > >unacceptable (60 bytes per allocation ?) and something more memory > >frugal is called for. > > > >This is a small API I just wrote, targeted specifically for allocating > >unit numbers and similar spaces. > > > >Currently the allocation policy is "lowest free number", but it > >would be possible to add support for allocating a specific number > >as well. > > > >It uses a mixed run-length/bitmap strategy with fixed size memory > >chunks (so it can use uma(9) in the kernel). > > > >Worst case memory usage is two bits per managed unit-number (worst > >case is "allocate all units, free all the odd numbered ones"). > > > >For the typical case where we never free any unit numbers, it will > >use 52 bytes in total on i386. > > > >Please review. (It can be run in userland) > > > >Poul-Henning > > please also look at the Thread_id (lwpid) allocator marcel added to > kern_thread.c Whatever we use, can we use it to manage pids as well to work around the problem with putting newborn processes onto allproc. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org