Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jan 2003 18:18:03 +0100
From:      Thomas Moestl <tmoestl@gmx.net>
To:        phk@freebsd.org
Cc:        Kris Kennaway <kris@obsecurity.org>, current@freebsd.org, alpha@freebsd.org
Subject:   Re: panic: malloc(M_WAITOK) returned NULL
Message-ID:  <20030118171803.GB283@crow.dom2ip.de>
In-Reply-To: <20030118122245.GA283@crow.dom2ip.de>
References:  <20030118045316.GA25224@rot13.obsecurity.org> <18381.1042876839@critter.freebsd.dk> <20030118122245.GA283@crow.dom2ip.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <tmoestl@gmx.net>	http://www.tu-bs.de/~y0015675/
              <tmm@FreeBSD.org>	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 <vm/pmap.h>
 #include <vm/vm_map.h>
 #include <vm/vm_page.h>
+#include <vm/vm_pageout.h>
 #include <vm/vm_param.h>
 #include <vm/uma.h>
 #include <vm/uma_int.h>
@@ -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




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