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.119 (requested by skrll):



details:   https://anonhg.NetBSD.org/src/rev/c7f4e698fc7d
branches:  netbsd-1-6
changeset: 530229:c7f4e698fc7d
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Jun 02 14:29:52 2003 +0000

description:
Pull up revision 1.119 (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_map.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 867ba2f4165a -r c7f4e698fc7d sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon Jun 02 14:23:26 2003 +0000
+++ b/sys/uvm/uvm_map.c Mon Jun 02 14:29:52 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.118 2002/03/08 20:48:47 thorpej Exp $    */
+/*     $NetBSD: uvm_map.c,v 1.118.8.1 2003/06/02 14:29:52 tron Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.118 2002/03/08 20:48:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.118.8.1 2003/06/02 14:29:52 tron Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -522,6 +522,7 @@
            UVM_MAXPROTECTION(flags);
        vm_inherit_t inherit = UVM_INHERIT(flags);
        int advice = UVM_ADVICE(flags);
+       int error;
        UVMHIST_FUNC("uvm_map");
        UVMHIST_CALLED(maphist);
 
@@ -656,7 +657,16 @@
                        goto nomerge;
                }
 
-               /* got it! */
+               if (prev_entry->aref.ar_amap) {
+                       error = amap_extend(prev_entry, size);
+                       if (error) {
+                               vm_map_unlock(map);
+                               if (new_entry) {
+                                       uvm_mapent_free(new_entry);
+                               }
+                               return error;
+                       }
+               }
 
                UVMCNT_INCR(map_backmerge);
                UVMHIST_LOG(maphist,"  starting back merge", 0, 0, 0, 0);
@@ -665,13 +675,10 @@
                 * drop our reference to uobj since we are extending a reference
                 * that we already have (the ref count can not drop to zero).
                 */
+
                if (uobj && uobj->pgops->pgo_detach)
                        uobj->pgops->pgo_detach(uobj);
 
-               if (prev_entry->aref.ar_amap) {
-                       amap_extend(prev_entry, size);
-               }
-
                prev_entry->end += size;
                map->size += size;
 



Home | Main Index | Thread Index | Old Index