From owner-freebsd-hackers Thu Aug 23 10:26:32 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from msgbas2.cos.agilent.com (msgbas2x.cos.agilent.com [192.25.240.37]) by hub.freebsd.org (Postfix) with ESMTP id 8FDA137B40C for ; Thu, 23 Aug 2001 10:26:25 -0700 (PDT) (envelope-from darrylo@soco.agilent.com) Received: from msgrel1.cos.agilent.com (msgrel1.cos.agilent.com [130.29.152.77]) by msgbas2.cos.agilent.com (Postfix) with ESMTP id 43B2674F; Thu, 23 Aug 2001 11:26:25 -0600 (MDT) Received: from mina.soco.agilent.com (mina.soco.agilent.com [141.121.54.157]) by msgrel1.cos.agilent.com (Postfix) with ESMTP id 7D4A94F0; Thu, 23 Aug 2001 11:26:24 -0600 (MDT) Received: from mina.soco.agilent.com (darrylo@localhost [127.0.0.1]) by mina.soco.agilent.com (8.9.3 (PHNE_22672)/8.9.3 SMKit7.1.1_Agilent) with ESMTP id KAA03359; Thu, 23 Aug 2001 10:26:22 -0700 (PDT) Message-Id: <200108231726.KAA03359@mina.soco.agilent.com> To: Alfred Perlstein Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: secure Filesystem Reply-To: Darryl Okahata In-Reply-To: Your message of "Thu, 16 Aug 2001 16:02:03 CDT." <20010816160203.N38066@elvis.mu.org> Mime-Version: 1.0 (generated by tm-edit 1.6) Content-Type: text/plain; charset=US-ASCII Date: Thu, 23 Aug 2001 10:26:21 -0700 From: Darryl Okahata 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 A while back, Alfred Perlstein wrote: > > However, on a somewhat aging 128MB laptop, a 200+MB cfsd puts the > > system into swap h*ll pretty quickly. I think cfsd has some linked > > lists which thrash a lot of pages. > > That's unfortunate. Good thing is that cfs is open source. > "Got Patches" ? :) A couple of months back, I briefly looked into it, but nothing (simple) came to mind. However, upon perusing the code again, cfsd appears to be using a plain hash table with 1024 buckets and a linked list at each bucket. The number of buckets is controlled by two simple #define's in cfs.h: #define HSIZE 1024 #define HMASK 0x3ff /* change these together, please */ These are pretty easy to change (HSIZE must currently be a power of 2), and you generally don't have to worry about hash function issues (the file inode is used as the "hash function"). My test case has 200000+ files, occupying ~1.4GB, and increasing the hash table size (number of buckets) to 1M (1024*1024) greatly improved swap performance (not surprising, as following the linked lists is what unnecessarily dragged in lots of pages). On my laptop with 128MB RAM, there was a significant change in resident memory footprint: VM used RES (max) original 1024 bucket cfsd: ? ? 128K bucket cfsd: 445MB 80-90MB 1024K bucket cfsd: 458MB 30-35MB (<20MB typ) Of course, increasing the number of buckets increased the initial cfsd size (to 14-16MB, in the case of the 1M buckets), but that's acceptable. [ And the cfsd process doesn't shrink when you cdetach .... ;-( ] -- Darryl Okahata darrylo@soco.agilent.com DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion, or policy of Agilent Technologies, or of the little green men that have been following him all day. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message