Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sys/kern Pull up revision 1.73 (requested by skrll):
details: https://anonhg.NetBSD.org/src/rev/9d6cecaaeec1
branches: netbsd-1-6
changeset: 530233:9d6cecaaeec1
user: tron <tron%NetBSD.org@localhost>
date: Mon Jun 02 14:30:26 2003 +0000
description:
Pull up revision 1.73 (requested by skrll):
add a new km flag UVM_KMF_CANFAIL, which causes uvm_km_kmemalloc() to
return failure if swap is full and there are no free physical pages.
have malloc() use this flag if M_CANFAIL is passed to it.
use M_CANFAIL to allow amap_extend() to fail when memory is scarce.
this should prevent most of the remaining hangs in low-memory situations.
diffstat:
sys/kern/kern_malloc.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 99e66eb523fb -r 9d6cecaaeec1 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c Mon Jun 02 14:30:18 2003 +0000
+++ b/sys/kern/kern_malloc.c Mon Jun 02 14:30:26 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_malloc.c,v 1.71 2002/04/03 09:45:22 fvdl Exp $ */
+/* $NetBSD: kern_malloc.c,v 1.71.4.1 2003/06/02 14:30:26 tron Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.71 2002/04/03 09:45:22 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.71.4.1 2003/06/02 14:30:26 tron Exp $");
#include "opt_lockdebug.h"
@@ -257,7 +257,8 @@
npg = btoc(allocsize);
va = (caddr_t) uvm_km_kmemalloc(kmem_map, NULL,
(vsize_t)ctob(npg),
- (flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0);
+ ((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) |
+ ((flags & M_CANFAIL) ? UVM_KMF_CANFAIL : 0));
if (__predict_false(va == NULL)) {
/*
* Kmem_malloc() can return NULL, even if it can
@@ -270,7 +271,7 @@
if ((flags & (M_NOWAIT|M_CANFAIL)) == 0)
panic("malloc: out of space in kmem_map");
splx(s);
- return ((void *) NULL);
+ return (NULL);
}
#ifdef KMEMSTATS
kbp->kb_total += kbp->kb_elmpercl;
Home |
Main Index |
Thread Index |
Old Index