Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2007 17:01:02 -0700
From:      Shawn O'Connor <soconnor@falconknight.com>
To:        Pieter de Goeje <pieter@degoeje.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: mdconfig using malloc()
Message-ID:  <DCA423A8-A657-4EB0-A252-48B79FFAF903@falconknight.com>
In-Reply-To: <200706290141.07063.pieter@degoeje.nl>
References:  <4D15FF0C-0531-4455-9631-F60D939F9EB2@falconknight.com> <200706290141.07063.pieter@degoeje.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jun 28, 2007, at 4:41 PM, Pieter de Goeje wrote:

> On Thursday 28 June 2007, Shawn O'Connor wrote:
>> Guys,
>>
>> I'm trying to do the following:
>>
>> mdconfig -a -t malloc -o reserve -s 2g
> You really don't want to do this. mdconfig will try to allocate 2G  
> of wired
> memory, which will obviously fail, because you really don't have  
> that much
> kernel memory available. This might work (with some tweaks) on a 64bit
> platform however.

I have 8GB of RAM on this machine.  Wouldn't allocating 2GB of it to  
a RAM disk would be okay?  It is an amd64.

I found this options that I can change in the kernel config file.  I  
think if I set them, I'll have enough KVM for this command to be  
performed.


options VM_KMEM_SIZE_MAX=2684354560
options VM_KMEM_SIZE_SCALE=2

That should give me  2.5GB of KVM, from which I should be able to  
safely allocate 2GB to a RAM disk, right?


>>
>> Which fails saying it can't:
>>
>>   mdconfig: ioctl(/dev/mdctl): Cannot allocate memory
>>
>> I saw some old post advocated using -t swap instead, saying that swap
>> probably wouldn't be used until real memory was consumed. But, on my
>> 6.2 machine that immediately raises the swap usage to 2GB and does
>> use disk instead of RAM when I test using it.
> That's because you used -o reserve. Leave it out and it'll be fine.

When using with -o reserve and swap it returns immediately, just like  
with -t malloc without the -o reserve (except without the nasty  
repercussions of running out of RAM).  My problem isn't that it uses  
the swap (nothing is using it anyway), but that it is using disk at  
all, which is way to slow for what I'm trying to do.

Thanks for the help!

	-Shawn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DCA423A8-A657-4EB0-A252-48B79FFAF903>