Reboots under 6.0 while exercising md device

James Long list at museum.rain.com
Thu Dec 22 16:11:41 PST 2005


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!



More information about the freebsd-questions mailing list