Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/uvm Pull up revision 1.58 (requested by skrll):



details:   https://anonhg.NetBSD.org/src/rev/bd92ec96f6b6
branches:  netbsd-1-6
changeset: 530234:bd92ec96f6b6
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 02 14:30:34 2003 +0000

description:
Pull up revision 1.58 (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/uvm/uvm_km.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 9d6cecaaeec1 -r bd92ec96f6b6 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Mon Jun 02 14:30:26 2003 +0000
+++ b/sys/uvm/uvm_km.c  Mon Jun 02 14:30:34 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_km.c,v 1.56.8.1 2002/11/18 01:29:48 he Exp $       */
+/*     $NetBSD: uvm_km.c,v 1.56.8.2 2003/06/02 14:30:34 tron Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -134,7 +134,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.56.8.1 2002/11/18 01:29:48 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.56.8.2 2003/06/02 14:30:34 tron Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -441,10 +441,15 @@
                 */
 
                if (__predict_false(pg == NULL)) {
-                       if (flags & UVM_KMF_NOWAIT) {
+                       int t;
+
+                       t = uvmexp.active + uvmexp.inactive + uvmexp.free;
+                       if ((flags & UVM_KMF_NOWAIT) ||
+                           ((flags & UVM_KMF_CANFAIL) &&
+                            uvmexp.swpgonly == uvmexp.swpages)) {
                                /* free everything! */
                                uvm_unmap(map, kva, kva + size);
-                               return(0);
+                               return (0);
                        } else {
                                uvm_wait("km_getwait2");        /* sleep here */
                                continue;



Home | Main Index | Thread Index | Old Index