From owner-freebsd-questions@FreeBSD.ORG Fri Dec 23 00:11:41 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4561316A41F for ; Fri, 23 Dec 2005 00:11:41 +0000 (GMT) (envelope-from james_mapson@umpquanet.com) Received: from ns.museum.rain.com (gw-ipinc.museum.rain.com [65.75.192.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BE2843D79 for ; Fri, 23 Dec 2005 00:11:31 +0000 (GMT) (envelope-from james_mapson@umpquanet.com) Received: from ns.museum.rain.com (localhost [127.0.0.1]) by ns.museum.rain.com (8.13.4/8.13.4) with ESMTP id jBN0BCxM032580 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Thu, 22 Dec 2005 16:11:16 -0800 (PST) (envelope-from james@umpquanet.com) Received: (from james@localhost) by ns.museum.rain.com (8.13.4/8.13.4/Submit) id jBN0B30d032579; Thu, 22 Dec 2005 16:11:03 -0800 (PST) (envelope-from james) Date: Thu, 22 Dec 2005 16:11:02 -0800 From: James Long To: freebsd-questions@freebsd.org Message-ID: <20051223001102.GA32544@ns.museum.rain.com> References: <20051222035049.GA25222@ns.museum.rain.com> <20051222043519.GA4610@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051222043519.GA4610@odin.ac.hmc.edu> User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-100.8 required=5.0 tests=ALL_TRUSTED, J_CHICKENPOX_62,USER_IN_WHITELIST autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on ns.museum.rain.com Cc: Brooks Davis Subject: Re: Reboots under 6.0 while exercising md device X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2005 00:11:41 -0000 On Wed, Dec 21, 2005 at 08:35:19PM -0800, Brooks Davis wrote: > On Wed, Dec 21, 2005 at 07:50:49PM -0800, James Long wrote: [snip] > > > > What do I need to fix to be able to use a RAM-backed filesystem? > > From mdconfig(8): > > -t type > Select the type of the memory disk. > > malloc Storage for this type of memory disk is allocated with > malloc(9). This limits the size to the malloc bucket > limit in the kernel. If the -o reserve option is not > set, creating and filling a large malloc-backed memory > disk is a very easy way to panic a system. > > As a rule, swap or vnode backed md devices are a better idea than malloc > ones. > > -- Brooks Thank you very much. That not only works much better, it shatters my ignorant misconception about the -t switch. If I may: I naively assumed that a malloc'ed RAMDISK would just remove X number of bytes of physical RAM from FreeBSD's VM system, and dedicate that RAM to a memory disk. Since this RAM would now be outside the VM system, contents of such RAM could never be swapped out, thus my memory disk would always be fast, but would reduce the physical RAM available to the VM system. I assumed a swap-backed disk would do similar, but would be subject to swapping if the memory disk data hadn't been accessed recently, and demand for new VM pages became sufficient to force the memory disk out of physical RAM into swap. My memory disk would usually be fast, provided that I accessed it frequently. Parts of the disk that were not accessed frequently could be swapped out to free up physical RAM, and re-accessing those parts would then mean a disk access to swap in the pertinent pages. I assumed a file-backed disk would be about the same as a swap-backed md, except that it's paged to and from a file system, instead of a swap partition. How much of that is wrong? :) And would *any* program that tried to malloc 500 megs of RAM be likely to crash the system, or is this a unique skill that mdconfig has mastered? Thanks!