Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by fair in t...



details:   https://anonhg.NetBSD.org/src/rev/784f51f898f2
branches:  netbsd-9
changeset: 942672:784f51f898f2
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Nov 14 15:36:11 2020 +0000

description:
Pull up following revision(s) (requested by fair in ticket #1130):

        sys/sys/param.h: revision 1.679
        sys/conf/param.c: revision 1.69
        sys/kern/init_main.c: revision 1.533

Set a better default for MAXFILES on larger RAM machines if not
otherwise specified the kernel config file.  Arbitary numbers are
20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or
more.

TODO: Adjust this and other values totally dynamically.

diffstat:

 sys/conf/param.c     |   8 ++------
 sys/kern/init_main.c |  21 ++++++++++++++++++---
 sys/sys/param.h      |  14 +++++++++-----
 3 files changed, 29 insertions(+), 14 deletions(-)

diffs (110 lines):

diff -r 0dbd1b9d0b22 -r 784f51f898f2 sys/conf/param.c
--- a/sys/conf/param.c  Sat Nov 14 13:03:10 2020 +0000
+++ b/sys/conf/param.c  Sat Nov 14 15:36:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.c,v 1.68 2019/04/09 22:05:27 pgoyette Exp $      */
+/*     $NetBSD: param.c,v 1.68.4.1 2020/11/14 15:36:11 martin Exp $    */
 
 /*
  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.68 2019/04/09 22:05:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.68.4.1 2020/11/14 15:36:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hz.h"
@@ -105,10 +105,6 @@
 #define        HZ 100
 #endif
 
-#ifndef MAXFILES
-#define        MAXFILES        (3 * (NPROC + MAXUSERS) + 80)
-#endif
-
 #ifndef MAXEXEC
 #define        MAXEXEC         16
 #endif
diff -r 0dbd1b9d0b22 -r 784f51f898f2 sys/kern/init_main.c
--- a/sys/kern/init_main.c      Sat Nov 14 13:03:10 2020 +0000
+++ b/sys/kern/init_main.c      Sat Nov 14 15:36:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.504 2019/05/17 03:34:26 ozaki-r Exp $  */
+/*     $NetBSD: init_main.c,v 1.504.2.1 2020/11/14 15:36:11 martin Exp $       */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.504 2019/05/17 03:34:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.504.2.1 2020/11/14 15:36:11 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -469,7 +469,22 @@
            10, VNODE_KMEM_MAXPCT) / VNODE_COST;
        if (usevnodes > desiredvnodes)
                desiredvnodes = usevnodes;
-#endif
+#endif /* NVNODE_IMPLICIT */
+#ifdef MAXFILES_IMPLICIT
+       /*
+        * If maximum number of files is not explicitly defined in
+        * kernel config, adjust the number so that it is somewhat
+        * more reasonable on machines with larger memory sizes.
+        * Arbitary numbers are 20,000 files for 16GB RAM or more
+        * and 10,000 files for 1GB RAM or more.
+        *
+        * XXXtodo: adjust this and other values totally dynamically
+        */
+       if (ctob((uint64_t)physmem) >= 16ULL * 1024 * 1024 * 1024)
+               maxfiles = MAX(maxfiles, 20000);
+       if (ctob((uint64_t)physmem) >= 1024 * 1024 * 1024)
+               maxfiles = MAX(maxfiles, 10000);
+#endif /* MAXFILES_IMPLICIT */
 
        /* Initialize fstrans. */
        fstrans_init();
diff -r 0dbd1b9d0b22 -r 784f51f898f2 sys/sys/param.h
--- a/sys/sys/param.h   Sat Nov 14 13:03:10 2020 +0000
+++ b/sys/sys/param.h   Sat Nov 14 15:36:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.h,v 1.599.2.8 2020/10/22 11:21:41 martin Exp $   */
+/*     $NetBSD: param.h,v 1.599.2.9 2020/11/14 15:36:11 martin Exp $   */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -148,13 +148,17 @@
 #include <sys/uio.h>
 #include <uvm/uvm_param.h>
 #ifndef NPROC
-#define        NPROC   (20 + 16 * MAXUSERS)
+#define        NPROC                   (20 + 16 * MAXUSERS)
+#endif
+#ifndef MAXFILES
+#define        MAXFILES                (3 * (NPROC + MAXUSERS) + 80)
+#define        MAXFILES_IMPLICIT
 #endif
 #ifndef NTEXT
-#define        NTEXT   (80 + NPROC / 8)                /* actually the object cache */
+#define        NTEXT                   (80 + NPROC / 8) /* actually the object cache */
 #endif
 #ifndef NVNODE
-#define        NVNODE  (NPROC + NTEXT + 100)
+#define        NVNODE                  (NPROC + NTEXT + 100)
 #define        NVNODE_IMPLICIT
 #endif
 #ifndef VNODE_KMEM_MAXPCT
@@ -163,7 +167,7 @@
 #ifndef BUFCACHE_VA_MAXPCT
 #define        BUFCACHE_VA_MAXPCT      20
 #endif
-#define        VNODE_COST      2048                    /* assumed space in bytes */
+#define        VNODE_COST              2048            /* assumed space in bytes */
 #endif /* _KERNEL */
 
 /* Signals. */



Home | Main Index | Thread Index | Old Index