Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Add new "kern.mbuf.nmbclusters_limit" sysctl.



details:   https://anonhg.NetBSD.org/src/rev/54a688419ca3
branches:  trunk
changeset: 372653:54a688419ca3
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Dec 16 08:42:55 2022 +0000

description:
Add new "kern.mbuf.nmbclusters_limit" sysctl.

 - Used to know the upper limit of nmbclusters.
 - It's read only.

diffstat:

 share/man/man7/sysctl.7 |   9 ++++++---
 sys/kern/uipc_mbuf.c    |  13 +++++++++++--
 sys/sys/mbuf.h          |   3 ++-
 3 files changed, 19 insertions(+), 6 deletions(-)

diffs (102 lines):

diff -r 8d757ade1cb9 -r 54a688419ca3 share/man/man7/sysctl.7
--- a/share/man/man7/sysctl.7   Fri Dec 16 08:02:04 2022 +0000
+++ b/share/man/man7/sysctl.7   Fri Dec 16 08:42:55 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysctl.7,v 1.162 2022/10/24 01:54:19 knakahara Exp $
+.\"    $NetBSD: sysctl.7,v 1.163 2022/12/16 08:42:55 msaitoh Exp $
 .\"
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)sysctl.3    8.4 (Berkeley) 5/9/95
 .\"
-.Dd October 24, 2022
+.Dd December 16, 2022
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -787,7 +787,7 @@
 The third level names for the mbuf variables are detailed below.
 The changeable column shows whether a process with appropriate
 privilege may change the value.
-.Bl -column "kern.mbuf.nmbclusters" "integer" "Changeable" -offset indent
+.Bl -column "kern.mbuf.nmbclusters_limit" "integer" "Changeable" -offset indent
 .It Sy Third level name Ta Sy Type Ta Sy Changeable
 .\" XXX Changeable? really?
 .It kern.mbuf.mblowat  integer yes
@@ -795,6 +795,7 @@
 .It kern.mbuf.mcllowat integer yes
 .It kern.mbuf.msize    integer yes
 .It kern.mbuf.nmbclusters      integer yes
+.It kern.mbuf.nmbclusters_limit        integer no
 .El
 .Pp
 The variables are as follows:
@@ -811,6 +812,8 @@
 The limit on the number of mbuf clusters.
 The variable can only be increased, and only increased on machines with
 direct-mapped pool pages.
+.It Li kern.mbuf.nmbclusters_limit ( Dv MBUF_NMBCLUSTERS_LIMIT )
+The limit of nmbclusters.
 .El
 .It Li kern.memlock ( Dv KERN_MEMLOCK )
 Returns 1 if the
diff -r 8d757ade1cb9 -r 54a688419ca3 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Fri Dec 16 08:02:04 2022 +0000
+++ b/sys/kern/uipc_mbuf.c      Fri Dec 16 08:42:55 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.246 2022/04/09 23:38:33 riastradh Exp $        */
+/*     $NetBSD: uipc_mbuf.c,v 1.247 2022/12/16 08:42:55 msaitoh Exp $  */
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.246 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.247 2022/12/16 08:42:55 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -289,6 +289,9 @@
        case MBUF_MCLLOWAT:
                newval = *(int*)rnode->sysctl_data;
                break;
+       case MBUF_NMBCLUSTERS_LIMIT:
+               newval = nmbclusters_limit();
+               break;
        default:
                return EOPNOTSUPP;
        }
@@ -487,6 +490,12 @@
                       sysctl_kern_mbuf_mowners, 0, NULL, 0,
                       CTL_KERN, KERN_MBUF, MBUF_MOWNERS, CTL_EOL);
 #endif
+       sysctl_createv(&mbuf_sysctllog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+                      CTLTYPE_INT, "nmbclusters_limit",
+                      SYSCTL_DESCR("Limit of nmbclusters"),
+                      sysctl_kern_mbuf, 0, NULL, 0,
+                      CTL_KERN, KERN_MBUF, MBUF_NMBCLUSTERS_LIMIT, CTL_EOL);
 }
 
 static int
diff -r 8d757ade1cb9 -r 54a688419ca3 sys/sys/mbuf.h
--- a/sys/sys/mbuf.h    Fri Dec 16 08:02:04 2022 +0000
+++ b/sys/sys/mbuf.h    Fri Dec 16 08:42:55 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbuf.h,v 1.236 2022/11/15 10:47:39 roy Exp $   */
+/*     $NetBSD: mbuf.h,v 1.237 2022/12/16 08:42:55 msaitoh Exp $       */
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -710,6 +710,7 @@
 #define MBUF_MCLLOWAT          5       /* int: mbuf cluster low water mark */
 #define MBUF_STATS             6       /* struct: mbstat */
 #define MBUF_MOWNERS           7       /* struct: m_owner[] */
+#define MBUF_NMBCLUSTERS_LIMIT 8       /* int: limit of nmbclusters */
 
 #ifdef _KERNEL
 extern struct mbstat mbstat;



Home | Main Index | Thread Index | Old Index