Module Name: src Committed By: msaitoh Date: Fri Dec 16 08:42:55 UTC 2022
Modified Files: src/share/man/man7: sysctl.7 src/sys/kern: uipc_mbuf.c src/sys/sys: mbuf.h Log Message: Add new "kern.mbuf.nmbclusters_limit" sysctl. - Used to know the upper limit of nmbclusters. - It's read only. To generate a diff of this commit: cvs rdiff -u -r1.162 -r1.163 src/share/man/man7/sysctl.7 cvs rdiff -u -r1.246 -r1.247 src/sys/kern/uipc_mbuf.c cvs rdiff -u -r1.236 -r1.237 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.162 src/share/man/man7/sysctl.7:1.163 --- src/share/man/man7/sysctl.7:1.162 Mon Oct 24 01:54:19 2022 +++ src/share/man/man7/sysctl.7 Fri Dec 16 08:42:55 2022 @@ -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 @@ structures in the networking code, see 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 @@ privilege may change the value. .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 mbuf base size. 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 Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.246 src/sys/kern/uipc_mbuf.c:1.247 --- src/sys/kern/uipc_mbuf.c:1.246 Sat Apr 9 23:38:33 2022 +++ src/sys/kern/uipc_mbuf.c Fri Dec 16 08:42:55 2022 @@ -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 @@ sysctl_kern_mbuf(SYSCTLFN_ARGS) 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_setup(void) 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 Index: src/sys/sys/mbuf.h diff -u src/sys/sys/mbuf.h:1.236 src/sys/sys/mbuf.h:1.237 --- src/sys/sys/mbuf.h:1.236 Tue Nov 15 10:47:39 2022 +++ src/sys/sys/mbuf.h Fri Dec 16 08:42:55 2022 @@ -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 @@ struct mbstat_cpu { #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;