Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm add {anon, file, exec}max as a upper bound on the amou...



details:   https://anonhg.NetBSD.org/src/rev/2103761d272e
branches:  trunk
changeset: 519008:2103761d272e
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Dec 09 03:07:19 2001 +0000

description:
add {anon,file,exec}max as a upper bound on the amount of memory that
will be allocated for the respective usage types when there is contention
for memory.

replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names
and sysctl names.

diffstat:

 sys/uvm/uvm_extern.h  |  32 ++++++++++-------
 sys/uvm/uvm_meter.c   |  90 ++++++++++++++++++++++++++++----------------------
 sys/uvm/uvm_page.c    |  23 +++++++-----
 sys/uvm/uvm_param.h   |  18 ++++++---
 sys/uvm/uvm_pdaemon.c |  37 ++++++++++++++------
 sys/uvm/uvm_stat.c    |  17 +++++---
 6 files changed, 132 insertions(+), 85 deletions(-)

diffs (truncated from 410 to 300 lines):

diff -r b3f33566e2fb -r 2103761d272e sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Sun Dec 09 03:06:46 2001 +0000
+++ b/sys/uvm/uvm_extern.h      Sun Dec 09 03:07:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.68 2001/12/08 00:35:33 thorpej Exp $  */
+/*     $NetBSD: uvm_extern.h,v 1.69 2001/12/09 03:07:19 chs Exp $      */
 
 /*
  *
@@ -256,9 +256,9 @@
        int zeropages;          /* number of zero'd pages */
        int reserve_pagedaemon; /* number of pages reserved for pagedaemon */
        int reserve_kernel;     /* number of pages reserved for kernel */
-       int anonpages;          /* number of pages used by anon pagers */
-       int vnodepages;         /* number of pages used by vnode page cache */
-       int vtextpages;         /* number of pages used by vtext vnodes */
+       int anonpages;          /* number of pages used by anon mappings */
+       int filepages;          /* number of pages used by cached file data */
+       int execpages;          /* number of pages used by cached exec date */
 
        /* pageout params */
        int freemin;    /* min number of free pages */
@@ -266,11 +266,17 @@
        int inactarg;   /* target number of inactive pages */
        int wiredmax;   /* max number of wired pages */
        int anonmin;    /* min threshold for anon pages */
-       int vtextmin;   /* min threshold for vtext pages */
-       int vnodemin;   /* min threshold for vnode pages */
+       int execmin;    /* min threshold for executable pages */
+       int filemin;    /* min threshold for file pages */
        int anonminpct; /* min percent anon pages */
-       int vtextminpct;/* min percent vtext pages */
-       int vnodeminpct;/* min percent vnode pages */
+       int execminpct; /* min percent executable pages */
+       int fileminpct; /* min percent file pages */
+       int anonmax;    /* max threshold for anon pages */
+       int execmax;    /* max threshold for executable pages */
+       int filemax;    /* max threshold for file pages */
+       int anonmaxpct; /* max percent anon pages */
+       int execmaxpct; /* max percent executable pages */
+       int filemaxpct; /* max percent file pages */
 
        /* swap */
        int nswapdev;   /* number of configured swap devices in system */
@@ -340,9 +346,9 @@
        int pdpageouts; /* number of times daemon started a pageout */
        int pdpending;  /* number of times daemon got a pending pagout */
        int pddeact;    /* number of pages daemon deactivates */
-       int pdreanon;   /* anon pages reactivated due to min threshold */
-       int pdrevnode;  /* vnode pages reactivated due to min threshold */
-       int pdrevtext;  /* vtext pages reactivated due to min threshold */
+       int pdreanon;   /* anon pages reactivated due to thresholds */
+       int pdrefile;   /* file pages reactivated due to thresholds */
+       int pdreexec;   /* executable pages reactivated due to thresholds */
 };
 
 /*
@@ -423,8 +429,8 @@
        int64_t pdpending;
        int64_t pddeact;
        int64_t anonpages;
-       int64_t vnodepages;
-       int64_t vtextpages;
+       int64_t filepages;
+       int64_t execpages;
        int64_t colorhit;
        int64_t colormiss;
        int64_t ncolors;
diff -r b3f33566e2fb -r 2103761d272e sys/uvm/uvm_meter.c
--- a/sys/uvm/uvm_meter.c       Sun Dec 09 03:06:46 2001 +0000
+++ b/sys/uvm/uvm_meter.c       Sun Dec 09 03:07:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_meter.c,v 1.22 2001/11/10 07:37:00 lukem Exp $     */
+/*     $NetBSD: uvm_meter.c,v 1.23 2001/12/09 03:07:19 chs Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.22 2001/11/10 07:37:00 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_meter.c,v 1.23 2001/12/09 03:07:19 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -160,44 +160,56 @@
        case VM_NKMEMPAGES:
                return (sysctl_rdint(oldp, oldlenp, newp, nkmempages));
 
+#define UPDATEMIN(a, ap, bp, cp)                                       \
+       {                                                               \
+               t = uvmexp.ap;                                          \
+               rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);       \
+               if (rv) {                                               \
+                       return rv;                                      \
+               }                                                       \
+               if (t + uvmexp.bp + uvmexp.cp > 95 || t < 0) {          \
+                       return EINVAL;                                  \
+               }                                                       \
+               uvmexp.ap = t;                                          \
+               uvmexp.a = t * 256 / 100;                               \
+               return rv;                                              \
+       }
+
        case VM_ANONMIN:
-               t = uvmexp.anonminpct;
-               rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);
-               if (rv) {
-                       return rv;
-               }
-               if (t + uvmexp.vtextminpct + uvmexp.vnodeminpct > 95 || t < 0) {
-                       return EINVAL;
-               }
-               uvmexp.anonminpct = t;
-               uvmexp.anonmin = t * 256 / 100;
-               return rv;
+               UPDATEMIN(anonmin, anonminpct, fileminpct, execminpct);
+
+       case VM_EXECMIN:
+               UPDATEMIN(execmin, execminpct, fileminpct, anonminpct);
+
+       case VM_FILEMIN:
+               UPDATEMIN(filemin, fileminpct, execminpct, anonminpct);
 
-       case VM_VTEXTMIN:
-               t = uvmexp.vtextminpct;
-               rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);
-               if (rv) {
-                       return rv;
-               }
-               if (uvmexp.anonminpct + t + uvmexp.vnodeminpct > 95 || t < 0) {
-                       return EINVAL;
-               }
-               uvmexp.vtextminpct = t;
-               uvmexp.vtextmin = t * 256 / 100;
-               return rv;
+#undef UPDATEMIN
+#define UPDATEMAX(a, ap)                                               \
+       {                                                               \
+               t = uvmexp.ap;                                          \
+               rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);       \
+               if (rv) {                                               \
+                       return rv;                                      \
+               }                                                       \
+               if (t > 100 || t < 0) {                                 \
+                       return EINVAL;                                  \
+               }                                                       \
+               uvmexp.ap = t;                                          \
+               uvmexp.a = t * 256 / 100;                               \
+               return rv;                                              \
+       }
 
-       case VM_VNODEMIN:
-               t = uvmexp.vnodeminpct;
-               rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);
-               if (rv) {
-                       return rv;
-               }
-               if (uvmexp.anonminpct + uvmexp.vtextminpct + t > 95 || t < 0) {
-                       return EINVAL;
-               }
-               uvmexp.vnodeminpct = t;
-               uvmexp.vnodemin = t * 256 / 100;
-               return rv;
+       case VM_ANONMAX:
+               UPDATEMAX(anonmax, anonmaxpct);
+
+       case VM_EXECMAX:
+               UPDATEMAX(execmax, execmaxpct);
+
+       case VM_FILEMAX:
+               UPDATEMAX(filemax, filemaxpct);
+
+#undef UPDATEMAX
 
        case VM_MAXSLP:
                return (sysctl_rdint(oldp, oldlenp, newp, maxslp));
@@ -293,8 +305,8 @@
        u.pdpending = uvmexp.pdpending;
        u.pddeact = uvmexp.pddeact;
        u.anonpages = uvmexp.anonpages;
-       u.vnodepages = uvmexp.vnodepages;
-       u.vtextpages = uvmexp.vtextpages;
+       u.filepages = uvmexp.filepages;
+       u.execpages = uvmexp.execpages;
        u.colorhit = uvmexp.colorhit;
        u.colormiss = uvmexp.colormiss;
 
diff -r b3f33566e2fb -r 2103761d272e sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Sun Dec 09 03:06:46 2001 +0000
+++ b/sys/uvm/uvm_page.c        Sun Dec 09 03:07:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.71 2001/11/10 07:37:00 lukem Exp $      */
+/*     $NetBSD: uvm_page.c,v 1.72 2001/12/09 03:07:19 chs Exp $        */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.71 2001/11/10 07:37:00 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.72 2001/12/09 03:07:19 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -198,9 +198,9 @@
        simple_unlock(&uvm.hashlock);
 
        if (UVM_OBJ_IS_VTEXT(uobj)) {
-               uvmexp.vtextpages--;
+               uvmexp.execpages--;
        } else if (UVM_OBJ_IS_VNODE(uobj)) {
-               uvmexp.vnodepages--;
+               uvmexp.filepages--;
        }
 
        /* object should be locked */
@@ -369,17 +369,22 @@
 
        /*
         * init various thresholds.
-        * XXXCDC - values may need adjusting
         */
 
        uvmexp.reserve_pagedaemon = 1;
        uvmexp.reserve_kernel = 5;
        uvmexp.anonminpct = 10;
-       uvmexp.vnodeminpct = 10;
-       uvmexp.vtextminpct = 5;
+       uvmexp.fileminpct = 10;
+       uvmexp.execminpct = 5;
+       uvmexp.anonmaxpct = 80;
+       uvmexp.filemaxpct = 50;
+       uvmexp.execmaxpct = 30;
        uvmexp.anonmin = uvmexp.anonminpct * 256 / 100;
-       uvmexp.vnodemin = uvmexp.vnodeminpct * 256 / 100;
-       uvmexp.vtextmin = uvmexp.vtextminpct * 256 / 100;
+       uvmexp.filemin = uvmexp.fileminpct * 256 / 100;
+       uvmexp.execmin = uvmexp.execminpct * 256 / 100;
+       uvmexp.anonmax = uvmexp.anonmaxpct * 256 / 100;
+       uvmexp.filemax = uvmexp.filemaxpct * 256 / 100;
+       uvmexp.execmax = uvmexp.execmaxpct * 256 / 100;
 
        /*
         * determine if we should zero pages in the idle loop.
diff -r b3f33566e2fb -r 2103761d272e sys/uvm/uvm_param.h
--- a/sys/uvm/uvm_param.h       Sun Dec 09 03:06:46 2001 +0000
+++ b/sys/uvm/uvm_param.h       Sun Dec 09 03:07:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_param.h,v 1.12 2001/08/05 03:33:16 matt Exp $      */
+/*     $NetBSD: uvm_param.h,v 1.13 2001/12/09 03:07:19 chs Exp $       */
 
 /*
  * Copyright (c) 1991, 1993
@@ -112,12 +112,15 @@
 #define        VM_NKMEMPAGES   4               /* kmem_map pages */
 #define        VM_UVMEXP2      5               /* struct uvmexp_sysctl */
 #define        VM_ANONMIN      6
-#define        VM_VTEXTMIN     7
-#define        VM_VNODEMIN     8
+#define        VM_EXECMIN      7
+#define        VM_FILEMIN      8
 #define        VM_MAXSLP       9
 #define        VM_USPACE       10
+#define        VM_ANONMAX      11
+#define        VM_EXECMAX      12
+#define        VM_FILEMAX      13
 
-#define        VM_MAXID        11              /* number of valid vm ids */
+#define        VM_MAXID        14              /* number of valid vm ids */
 
 #define        CTL_VM_NAMES { \
        { 0, 0 }, \
@@ -127,10 +130,13 @@
        { "nkmempages", CTLTYPE_INT }, \
        { "uvmexp2", CTLTYPE_STRUCT }, \
        { "anonmin", CTLTYPE_INT }, \
-       { "vtextmin", CTLTYPE_INT }, \
-       { "vnodemin", CTLTYPE_INT }, \
+       { "execmin", CTLTYPE_INT }, \
+       { "filemin", CTLTYPE_INT }, \
        { "maxslp", CTLTYPE_INT }, \
        { "uspace", CTLTYPE_INT }, \
+       { "anonmax", CTLTYPE_INT }, \
+       { "execmax", CTLTYPE_INT }, \
+       { "filemax", CTLTYPE_INT }, \
 }
 
 #ifndef ASSEMBLER
diff -r b3f33566e2fb -r 2103761d272e sys/uvm/uvm_pdaemon.c
--- a/sys/uvm/uvm_pdaemon.c     Sun Dec 09 03:06:46 2001 +0000
+++ b/sys/uvm/uvm_pdaemon.c     Sun Dec 09 03:07:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdaemon.c,v 1.42 2001/11/10 07:37:01 lukem Exp $   */
+/*     $NetBSD: uvm_pdaemon.c,v 1.43 2001/12/09 03:07:19 chs Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.



Home | Main Index | Thread Index | Old Index