mdconfig using malloc()
Pieter de Goeje
pieter at degoeje.nl
Tue Jul 3 01:22:44 UTC 2007
On Friday 29 June 2007, Shawn O'Connor wrote:
> 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
> 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?
It allows FreeBSD to indeed allocate up to 2.5GB of KVM. But... there must
ofcourse be enough kvm to begin with. If I'm completely wrong here please
someone correct me.
Check sysctl vm.kvm_size to see the limit. Changing the amount of kvm is not
something that I know how to do.
> >> 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!
No problem :)
Pieter de Goeje
More information about the freebsd-questions