Date: Thu, 22 Dec 2005 16:11:02 -0800 From: James Long <list@museum.rain.com> To: freebsd-questions@freebsd.org Cc: Brooks Davis <brooks@one-eyed-alien.net> Subject: Re: Reboots under 6.0 while exercising md device Message-ID: <20051223001102.GA32544@ns.museum.rain.com> In-Reply-To: <20051222043519.GA4610@odin.ac.hmc.edu> References: <20051222035049.GA25222@ns.museum.rain.com> <20051222043519.GA4610@odin.ac.hmc.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051223001102.GA32544>