Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm hack around a UVM problem that causes hangs when lar...



details:   https://anonhg.NetBSD.org/src/rev/50de460ee4ba
branches:  trunk
changeset: 573499:50de460ee4ba
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Jan 30 17:23:05 2005 +0000

description:
hack around a UVM problem that causes hangs when large processes fork.
see PR 26908 for details.

diffstat:

 sys/uvm/uvm_amap.c    |  15 +++++++++++++--
 sys/uvm/uvm_pdaemon.c |  16 +++++++++++++---
 2 files changed, 26 insertions(+), 5 deletions(-)

diffs (95 lines):

diff -r c31bce219785 -r 50de460ee4ba sys/uvm/uvm_amap.c
--- a/sys/uvm/uvm_amap.c        Sun Jan 30 16:56:26 2005 +0000
+++ b/sys/uvm/uvm_amap.c        Sun Jan 30 17:23:05 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_amap.c,v 1.56 2005/01/01 21:00:06 yamt Exp $       */
+/*     $NetBSD: uvm_amap.c,v 1.57 2005/01/30 17:23:05 chs Exp $        */
 
 /*
  *
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.56 2005/01/01 21:00:06 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.57 2005/01/30 17:23:05 chs Exp $");
 
 #undef UVM_AMAP_INLINE         /* enable/disable amap inlines */
 
@@ -204,6 +204,17 @@
        free(amap->am_slots, M_UVMAMAP);
 fail1:
        pool_put(&uvm_amap_pool, amap);
+
+       /*
+        * XXX hack to tell the pagedaemon how many pages we need,
+        * since we can need more than it would normally free.
+        */
+       if (waitf == M_NOWAIT) {
+               extern int uvm_extrapages;
+               uvm_extrapages += ((sizeof(int) * 2 +
+                                   sizeof(struct vm_anon *)) *
+                                  totalslots) >> PAGE_SHIFT;
+       }
        return (NULL);
 }
 
diff -r c31bce219785 -r 50de460ee4ba sys/uvm/uvm_pdaemon.c
--- a/sys/uvm/uvm_pdaemon.c     Sun Jan 30 16:56:26 2005 +0000
+++ b/sys/uvm/uvm_pdaemon.c     Sun Jan 30 17:23:05 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdaemon.c,v 1.60 2004/10/03 08:47:48 enami Exp $   */
+/*     $NetBSD: uvm_pdaemon.c,v 1.61 2005/01/30 17:23:05 chs Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.60 2004/10/03 08:47:48 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.61 2005/01/30 17:23:05 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -104,6 +104,11 @@
 void           uvmpd_tune(void);
 
 /*
+ * XXX hack to avoid hangs when large processes fork.
+ */
+int uvm_extrapages;
+
+/*
  * uvm_wait: wait (sleep) for the page daemon to free some pages
  *
  * => should be called with all locks released
@@ -183,6 +188,9 @@
        if (uvmexp.freetarg <= uvmexp.freemin)
                uvmexp.freetarg = uvmexp.freemin + 1;
 
+       uvmexp.freetarg += uvm_extrapages;
+       uvm_extrapages = 0;
+
        /* uvmexp.inactarg: computed in main daemon loop */
 
        uvmexp.wiredmax = uvmexp.npages / 3;
@@ -198,6 +206,7 @@
 uvm_pageout(void *arg)
 {
        int bufcnt, npages = 0;
+       int extrapages = 0;
        UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist);
 
        UVMHIST_LOG(pdhist,"<starting uvm pagedaemon>", 0, 0, 0, 0);
@@ -230,8 +239,9 @@
                 */
 
                uvm_lock_pageq();
-               if (npages != uvmexp.npages) {  /* check for new pages? */
+               if (npages != uvmexp.npages || extrapages != uvm_extrapages) {
                        npages = uvmexp.npages;
+                       extrapages = uvm_extrapages;
                        uvmpd_tune();
                }
 



Home | Main Index | Thread Index | Old Index