From owner-freebsd-current@FreeBSD.ORG Sun Jan 27 18:11:46 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6D932DF3; Sun, 27 Jan 2013 18:11:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 3DB38ED3; Sun, 27 Jan 2013 18:11:46 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.6/8.14.6) with ESMTP id r0RIBjOO031679; Sun, 27 Jan 2013 11:11:45 -0700 (MST) (envelope-from ian@FreeBSD.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r0RIBgqW019718; Sun, 27 Jan 2013 11:11:42 -0700 (MST) (envelope-from ian@FreeBSD.org) Subject: Trouble with recent auto-tuning changes From: Ian Lepore To: freebsd-current@FreeBSD.org Content-Type: text/plain; charset="us-ascii" Date: Sun, 27 Jan 2013 11:11:42 -0700 Message-ID: <1359310302.93359.48.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Andre Oppermann X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2013 18:11:46 -0000 I ran into a panic while attempting to un-tar a large file on a DreamPlug (arm-based system) running -current. The source and dest of the un-tar is the root filesystem on sdcard, and I get this: panic: kmem_malloc(4096): kmem_map too small: 12582912 total allocated Just before the panic I see the tar process get hung in a "nokva" wait. 12582912 is the value of VM_KMEM_SIZE from arm/include/vmparam.h. In r245575 the init order for mbuf limits was changed from SI_SUB_TUNABLES to SI_SUB_KMEM so that mbuf limits could be based on the results of sizing kernel memory. Unfortunately, the process of sizing kernel memory relies on the mbuf limits; in kmeminit(): vm_kmem_size = VM_KMEM_SIZE + nmbclusters * PAGE_SIZE; Since r245575, nmbclusters is zero when this line of code runs. If I manually plugin "32768" (the number tunable_mbinit() comes up with for this platform) in that line, the panic stops happening. So we've got two problems here... one is the circular dependency in calculating the mbuf limits. The other is the fact that some non-trivial amount of kernel memory we're allowing for mbufs is actually being used for other things. That is, if my system was actually using all the mbufs that tunable_mbinit() allowed for, then this panic while untarring a huge file would still have happened. I arrive at the latter conclusion based on the fact that this panic happens even if no network interfaces (other than lo0) are configured. That is, nmbclusters == 0 is a reasonable approximation of my need for network mbufs. So something in the system needs to be taken into account when sizing kernel memory to allow for whatever it is about untarring a huge file that eats kernel memory (buffer cache?). I can easily reproduce this if you need me to gather any specific info. -- Ian