very strange reaction of the md disks

Oliver Fromme olli at
Wed Jun 11 16:36:27 UTC 2008


I don't know why nobody else has given the correct answer
to this (it's should actually be a FAQ).  So I'll try to
give an answer.

The Ghost <the-ghost at> wrote:
 > Hello,
 > Maybe I just don't understand something, but anyway, it looks really odd.
 > I have a machine with 2 Gb RAM with a clean newly-installed
 > FREEBSD-7.0-RELEASE. I make two 300-MB mdconfig disks and populate
 > them, and when the first one was already full and the second one is
 > only half-full, I get a kernel panic "not enough memory".

Use "-t swap" with mdconfig(8), not "-t malloc".

 > [...]
 > I was very surprised to see that one gigabyte of my
 > memory suddenly became used up.

FreeBSD uses all memory for caching, as far as possible.
Free memory is wasted memory.

 > A friend of mine told me that such a panic is really a thing to write
 > a bugreport on it,

No.  It is clearly documented in the mdconfig(8) manpage:
"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 I said above, you probably don't want a malloc-backed
memory disk (which means it consumes non-pagable kernel
memory), but a swap-backed disk (which is cached in regular
RAM and backed by swap).

If you're absolutely sure you want kernel-malloc for your
memory disk, you need to increase the kmem limit (see
"sysctl vm | grep kmem").

Best regards

Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:

"To this day, many C programmers believe that 'strong typing'
just means pounding extra hard on the keyboard."
        -- Peter van der Linden

More information about the freebsd-questions mailing list