From owner-freebsd-current Sat Jan 18 9:16:25 2003 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 A0F4037B405 for ; Sat, 18 Jan 2003 09:16:22 -0800 (PST) Received: from mail.gmx.net (mail.gmx.net [213.165.65.60]) by mx1.FreeBSD.org (Postfix) with SMTP id 7164043F6B for ; Sat, 18 Jan 2003 09:16:20 -0800 (PST) (envelope-from tmoestl@gmx.net) Received: (qmail 2170 invoked by uid 0); 18 Jan 2003 17:16:18 -0000 Received: from p508e6b6b.dip.t-dialin.net (HELO galatea.local) (80.142.107.107) by mail.gmx.net (mp010-rz3) with SMTP; 18 Jan 2003 17:16:18 -0000 Received: from localhost ([127.0.0.1] helo=galatea.local) by galatea.local with esmtp (Exim 4.12 #1) id 18Zwbh-000LdI-00; Sat, 18 Jan 2003 18:18:09 +0100 Received: (from tmm@localhost) by galatea.local (8.12.6/8.12.6/Submit) id h0IHI4gC083155; Sat, 18 Jan 2003 18:18:04 +0100 (CET) Date: Sat, 18 Jan 2003 18:18:03 +0100 From: Thomas Moestl To: phk@freebsd.org Cc: Kris Kennaway , current@freebsd.org, alpha@freebsd.org Subject: Re: panic: malloc(M_WAITOK) returned NULL Message-ID: <20030118171803.GB283@crow.dom2ip.de> Mail-Followup-To: phk@freebsd.org, Kris Kennaway , current@freebsd.org, alpha@freebsd.org References: <20030118045316.GA25224@rot13.obsecurity.org> <18381.1042876839@critter.freebsd.dk> <20030118122245.GA283@crow.dom2ip.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030118122245.GA283@crow.dom2ip.de> User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 2003/01/18 at 13:22:45 +0100, Thomas Moestl wrote: > None of the two could have caused this panic. I would guess that it > was caused by the alpha uma_small_alloc() implementation trying less > hard to allocate a page than kmem_alloc() (i.e. it does not sleep at > all). This problem does also affect the ia64 and sparc64 > uma_small_alloc() versions it seems. To follow up on this, the attached patch should fix the problem if this was really the cause. It makes the alpha and sparc64 implementations wait if requested (I don't know how I got the idea that there was an ia64 one, must have accidentially opened the wrong file). - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C Index: alpha/alpha/pmap.c =================================================================== RCS file: /d/ncvs/src/sys/alpha/alpha/pmap.c,v retrieving revision 1.117 diff -u -r1.117 pmap.c --- alpha/alpha/pmap.c 28 Dec 2002 22:47:45 -0000 1.117 +++ alpha/alpha/pmap.c 18 Jan 2003 16:50:19 -0000 @@ -582,7 +582,14 @@ if (wait & M_ZERO) pflags |= VM_ALLOC_ZERO; - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + for (;;) { + m = vm_page_alloc(NULL, color, pflags | VM_ALLOC_NOOBJ); + if (m == NULL && (wait & M_NOWAIT) == 0) + VM_WAIT; + else + break; + } + color++; if (m) { va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); Index: sparc64/sparc64/vm_machdep.c =================================================================== RCS file: /d/ncvs/src/sys/sparc64/sparc64/vm_machdep.c,v retrieving revision 1.32 diff -u -r1.32 vm_machdep.c --- sparc64/sparc64/vm_machdep.c 5 Jan 2003 05:30:40 -0000 1.32 +++ sparc64/sparc64/vm_machdep.c 18 Jan 2003 17:00:51 -0000 @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -330,7 +331,14 @@ if (wait & M_ZERO) pflags |= VM_ALLOC_ZERO; - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + for (;;) { + m = vm_page_alloc(NULL, color, pflags | VM_ALLOC_NOOBJ); + if (m == NULL && (wait & M_NOWAIT) == 0) + VM_WAIT; + else + break; + } + color++; if (m) { pa = VM_PAGE_TO_PHYS(m); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message