Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2007 08:04:33 -0500 (CDT)
From:      Larry Rosenman <ler@lerctr.org>
To:        Kris Kennaway <kris@FreeBSD.org>
Cc:        Darren Reed <darrenr@FreeBSD.org>, freebsd-current@FreeBSD.org, Ruslan Ermilov <ru@FreeBSD.org>
Subject:   Re: panic: kmem_malloc(131072): kmem_map too small (AMD64)
Message-ID:  <20070924080347.O84223@thebighonker.lerctr.org>
In-Reply-To: <46F78C59.1020801@FreeBSD.org>
References:  <20070921102946.T11189@borg> <46F415BF.9010500@FreeBSD.org> <20070921140550.D96923@thebighonker.lerctr.org> <46F41CFF.6080108@FreeBSD.org> <46F58799.1030702@freebsd.org> <46F58B21.8030307@FreeBSD.org> <20070924091558.GB32006@team.vega.ru> <46F78C59.1020801@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Sep 2007, Kris Kennaway wrote:

> Ruslan Ermilov wrote:
>> On Sat, Sep 22, 2007 at 11:37:37PM +0200, Kris Kennaway wrote:
>>> Darren Reed wrote:
>>>> Kris Kennaway wrote:
>>>>> Larry Rosenman wrote:
>>>>>> On Fri, 21 Sep 2007, Kris Kennaway wrote:
>>>>>> 
>>>>>>> Larry Rosenman wrote:
>>>>>>>> I'm a heavy ZFS user, and got the following panic on 2007-09-18 
>>>>>>>> source/world:
>>>>>>> This is a FAQ, please see the archives (you need to increase the 
>>>>>>> vm.kmem_size to provide more memory to ZFS).
>>>>>> I thought that was only for i386, and it hadn't been an issue before.
>>>>> Nope.  It is also load-dependent.
>>>> So I just received this courtesy of ZFS:
>>>> panic: kmem_malloc(131072): kmem_map too small: 343027712 total allocated
>>>> cpuid = 0
>>>> KDB: enter: panic
>>>> This was with these settings in loader.conf:
>>>> vm.kmem_size=419430400
>>>> vm.kmem_size_max=419430400
>> 
>> Setting both doesn't make sense; kmem_size will take over.
>> kmem_size_max only limits the automatically computed value
>> of kmem_size, which is:
>> 
>> /*
>>  * How many physical pages per KVA page allocated.
>>  * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
>>  *     VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
>>  * is the total KVA space allocated for kmem_map.
>>  */
>> 
>>>> vfs.zfs.arc_max=409715200
>>>> (That's 400M, 400M and 40M, respectively.)
>>>> Stupid question, perhaps, but is vm.kmem_size/vm.kmem_size_max limited by 
>>>> physical RAM?
>>> Yes.
>>> 
>> To be precise, it's actually limited by 2 * sizeof(physical RAM).
>> It's still size of a _virtual_ memory map (kmem_map), after all:
>> 
>> :	/*
>> : 	 * Limit kmem virtual size to twice the physical memory.
>> : 	 * This allows for kmem map sparseness, but limits the size
>> : 	 * to something sane. Be careful to not overflow the 32bit
>> : 	 * ints while doing the check.
>> : 	 */
>> : 	if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count)
>> : 		vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE;
>
> Well OK, but that seems pretty dangerous, because it leaves open a pathway to 
> exhaust all of physical memory and presumably panic.

is KVA pageable?  Is the kmem_map dedicating non-pageable memory?

I've set my vm.kmem_max to 1G, (on a 4G amd64 box).  Is that reasonable?

LER

>
> Kris
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>

-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 512-248-2683                 E-Mail: ler@lerctr.org
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893



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