From owner-freebsd-current@FreeBSD.ORG Sun Jan 18 20:49:43 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A93316A4CE; Sun, 18 Jan 2004 20:49:43 -0800 (PST) Received: from ftp.bjpu.edu.cn (ftp.bjpu.edu.cn [202.112.78.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3CC243D39; Sun, 18 Jan 2004 20:49:40 -0800 (PST) (envelope-from delphij@frontfree.net) Received: by ftp.bjpu.edu.cn (Postfix, from userid 426) id 4279D52D4; Mon, 19 Jan 2004 12:49:39 +0800 (CST) Received: from beastie.frontfree.net (beastie.frontfree.net [218.107.145.7]) by ftp.bjpu.edu.cn (Postfix) with ESMTP id F097D5299; Mon, 19 Jan 2004 12:49:38 +0800 (CST) Received: by beastie.frontfree.net (Postfix, from userid 426) id 84FF21183A; Mon, 19 Jan 2004 12:49:37 +0800 (CST) Received: from srv (unknown [192.168.122.253]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by beastie.frontfree.net (Postfix) with ESMTP id 44D0D114C9; Mon, 19 Jan 2004 12:49:36 +0800 (CST) From: "Xin LI" To: "'Jeff Roberson'" , "'Alan Cox'" Date: Mon, 19 Jan 2004 12:49:45 +0800 Organization: Phantasm Studio MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <20040115162427.L36463-100000@mail.chesapeake.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Thread-Index: AcPbtlALllFuXhGTQve+pW3iySNGAQCjnQTA Message-Id: <20040119044936.44D0D114C9@beastie.frontfree.net> cc: alc@freebsd.org cc: 'Jun Su' cc: current@freebsd.org Subject: RE: PANIC in kmem_alloc when loading many modules X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Mon, 19 Jan 2004 04:49:43 -0000 > -----Original Message----- > From: owner-freebsd-current@freebsd.org > [mailto:owner-freebsd-current@freebsd.org] On Behalf Of Jeff Roberson > Sent: Friday, January 16, 2004 5:25 AM > To: Alan Cox > Cc: alc@freebsd.org; Jun Su; current@freebsd.org > Subject: Re: PANIC in kmem_alloc when loading many modules > > > I missed the beginning of this thread. Are we loading modules > before the VM is bootstrapped? If we are, we should probably > fix that. If not, why do we need more boot pages? I tend to agree Jeff's opinion. It seems that kmem_malloc has an (inappropriate) self recursive call while it is holding the non-recursive lock, (line 326 of vm/vm_kern.c, http://current.freebsd.org/tour/current/kernel/S/4393.html#326). By increasing boot pages, we may hide some (potential?) problems and make it harder to track down. A brief reading of the code told me that when vm_map_findspace return 0, in other words, we found a space, then the lock would be kept held by kmem_alloc, but at line 346, vm_map_insert would have a chance to call kmem_malloc through the following call path: kmem_malloc(346) -> vm_map_insert(843) -> vm_map_entry_create(555) -> uma_zalloc(234) -> uma_zalloc_arg(1459) -> uma_zalloc_bucket(1619) -> uma_zone_slab(1529) -> slab_zalloc(750, through zone->uz_allocf function pointer) -> startup_alloc(821) -> page_alloc(842) -> kmem_malloc (PANIC Here because recursively lock on non-recursive lock) Maybe we should re-implement page_alloc to prevent kmem_malloc call? I am not familiar with the VM code so that's just my 2 cents. Thanks in advance! Xin LI