Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Nov 2003 06:00:40 -0800 (PST)
From:      "Brian K. White" <brian@aljex.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/53350: fill up a malloc md-disk on 5.1-R causes panic
Message-ID:  <200311161400.hAGE0ewP061876@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/53350; it has been noted by GNATS.

From: "Brian K. White" <brian@aljex.com>
To: "Jason Kuri" <jay@oneway.com>
Cc: <freebsd-gnats-submit@FreeBSD.org>
Subject: Re: kern/53350: fill up a malloc md-disk on 5.1-R causes panic
Date: Sun, 16 Nov 2003 08:52:14 -0500

 ----- Original Message ----- 
 From: "Jason Kuri" <jay@oneway.com>
 To: "Brian K. White" <brian@aljex.com>
 Cc: <freebsd-gnats-submit@FreeBSD.org>
 Sent: Saturday, November 15, 2003 6:24 PM
 Subject: Re: kern/53350: fill up a malloc md-disk on 5.1-R causes panic
 
 
 > Hello Brian,
 > 
 > This is not a bug, per se.   You see, though you have 1G of ram in the
 > machine, the system only reserves a certain amount for kernel memory
 > (max 200M by default).  MD-disks are entirely stored in kernel memory
 > and they do not auto-allocate, so you can create a 768M MD disk, but
 > the memory in the kernel is not actually allocated for it until you try
 > to use it.
 > 
 > The end result of all this is that you can create a large MD disk, and
 > it will work... until you try to fill it up... at which point it will
 > panic the kernel because the kernel has run out of memory.
 > 
 > The way to test this is to add the -o reserve option to the mdconfig
 > command.  It will fail/panic immediately instead of waiting until you
 > fill it up.  That option requires the memory to be pre-allocated rather
 > than allocated as needed.
 > 
 > The way to fix it is to change two options in your kernel config:
 > 
 > options VM_KMEM_SIZE_MAX    "(800*1024*1024)"
 > options VM_KMEM_SIZE_SCALE "2"
 > 
 > These will increase the amount of space allocated to the kernel...
 > VM_KMEM_SIZE_SCALE is a scaling factor.... meaning that the kernel will
 > get physical-memory/VM_KMEM_SIZE_SCALE up to VM_KMEM_SIZE_MAX... which
 > in the above case is 800M.   The above settings on a 1G machine would
 > result in you having 512M for the kernel... Please note, however, that
 > this memory is what is allocated for EVERYTHING in the kernel... so if
 > you fill the memory with an MD-disk of 512M, you would probably crash
 > again.
 > 
 > I don't know what will happen if you set VM_KMEM_SIZE_SCALE = 1... I've
 > only ever used about 400M of MD-disk on a 2G machine... in which case
 > VM_KMEM_SIZE_SCALE=2 is still ok.  You'll have to try it out and see...
 >   let me know how it goes.
 > 
 > Please read this:
 > 
 > http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2003-06/
 > 1599.html
 > 
 > to understand how it works a bit more.
 > 
 > And good luck.
 > 
 > Jay
 > 
 > 
 > 
 > On Nov 13, 2003, at 5:30 PM, Brian K. White wrote:
 > 
 > > Re: kern/53350: fill up a malloc md-disk on 5.1-R causes panic
 > >
 > > I get the same thing on a 1G machine when trying to use a 768 M
 > > ramdisk when
 > > the ramdisk is only 25% full.
 > > It never fails at exactly the same place, but always within a minute
 > > or two
 > > and it never gets anywhere close to filling up the md-disk.
 > >
 > > In my case I was creating the 768 meg malloc disc and trying to copy
 > > /usr/src into it.
 > > initially I tried a couple times with midnight commander, and after
 > > that
 > > crashed twice, I tried just using tar
 > >
 > > mdconfig -a -t malloc -s 768m
 > > newfs -U /dev/md0
 > > mount /dev/md0 /md0
 > > cd /usr/src ;tar cvf - * |(cd /md0 ;tar xvf - )
 > >
 > > /usr/src is only about 350 megs so it should fit easy, but just in
 > > case some
 > > difference in block sizes cause the same data to take up mor room on
 > > md0
 > > than it does on the hard drive, I watched df in another console while
 > > it was
 > > copying.
 > >
 > > repeatedly looking at df in another consle showed the disk only
 > > reaching
 > > about 25% full at the time of kernel panic.
 > >
 > > I got some different messages each time
 > > one time I just got this line repeated scrolling up the console untill
 > > I
 > > decided to power off:
 > >   initiate_write_filepage: already started
 > >
 > > the last time I got this:
 > >   panic: kmem_malloc(4096) kmem_map too small: 275251200 total
 > > allocated
 > >   syncing disks, buffers remaining... 7095
 > >   panic: initiate_write_inodeblock_ufs2: already started
 > >
 > > This is the 5.1 that is on the 5.1 iso as of about Nov/03/2003
 
 Thank you very much.
 I appreciate the help.
 
 Brian K. White  --  brian@aljex.com  --  http://www.aljex.com/bkw/
 +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
 filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311161400.hAGE0ewP061876>