Module Name: src
Committed By: martin
Date: Mon Oct 25 15:49:49 UTC 2021
Modified Files:
src/share/man/man4 [netbsd-8]: options.4
src/sys/conf [netbsd-8]: files
src/sys/kern [netbsd-8]: uipc_mbuf.c
Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1703):
sys/conf/files: revision 1.1288
sys/kern/uipc_mbuf.c: revision 1.244
share/man/man4/options.4: revision 1.520
Fix a bug that NMBCLUSTERS(kern.mbuf.nmbclusters) can't be changed by sysctl.
Update the description of the NMBCLUSTERS. Add NMBCLUSTERS_MAX.
defparam NMBCLUSTERS_MAX.
To generate a diff of this commit:
cvs rdiff -u -r1.466.2.2 -r1.466.2.3 src/share/man/man4/options.4
cvs rdiff -u -r1.1173.2.9 -r1.1173.2.10 src/sys/conf/files
cvs rdiff -u -r1.172.6.5 -r1.172.6.6 src/sys/kern/uipc_mbuf.c
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/man4/options.4
diff -u src/share/man/man4/options.4:1.466.2.2 src/share/man/man4/options.4:1.466.2.3
--- src/share/man/man4/options.4:1.466.2.2 Mon Sep 2 16:39:20 2019
+++ src/share/man/man4/options.4 Mon Oct 25 15:49:49 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: options.4,v 1.466.2.2 2019/09/02 16:39:20 martin Exp $
+.\" $NetBSD: options.4,v 1.466.2.3 2021/10/25 15:49:49 martin Exp $
.\"
.\" Copyright (c) 1996
.\" Perry E. Metzger. All rights reserved.
@@ -2184,15 +2184,20 @@ Mbuf clusters are MCLBYTES in size (usua
This is used to compute the size of the kernel VM map
.Em mb_map ,
which maps mbuf clusters.
-Default on most ports is 1024 (2048 with
-.Dq options GATEWAY
-).
+The default value is calculated from the amount of physical memory.
+Architectures without direct mapping also limit it based on the kmem_map size,
+which is used as backing store.
+Some archs limit the value with
+.Sq NMBCLUSTERS_MAX .
See
.Pa /usr/include/machine/param.h
-for exact default information.
+for those archs.
+This value can be accessed via the kern.mbuf.nmbclusters sysctl variable.
Increase this value if you get
.Dq mclpool limit reached
messages.
+.It Cd options NMBCLUSTERS_MAX=value
+The upper limit of NMBCLUSTERS.
.It Cd options NKMEMPAGES=value
.It Cd options NKMEMPAGES_MIN=value
.It Cd options NKMEMPAGES_MAX=value
Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1173.2.9 src/sys/conf/files:1.1173.2.10
--- src/sys/conf/files:1.1173.2.9 Sun Mar 8 09:42:29 2020
+++ src/sys/conf/files Mon Oct 25 15:49:48 2021
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1173.2.9 2020/03/08 09:42:29 martin Exp $
+# $NetBSD: files,v 1.1173.2.10 2021/10/25 15:49:48 martin Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20170615
@@ -272,6 +272,7 @@ defflag opt_pppoe.h PPPOE_SERVER PPPOE_
#
defflag GATEWAY
defparam opt_nmbclusters.h NMBCLUSTERS
+ NMBCLUSTERS_MAX
defparam SB_MAX
# file system options
Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.5 src/sys/kern/uipc_mbuf.c:1.172.6.6
--- src/sys/kern/uipc_mbuf.c:1.172.6.5 Tue May 22 17:50:27 2018
+++ src/sys/kern/uipc_mbuf.c Mon Oct 25 15:49:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $ */
+/* $NetBSD: uipc_mbuf.c,v 1.172.6.6 2021/10/25 15:49:49 martin Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.6 2021/10/25 15:49:49 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_mbuftrace.h"
@@ -163,11 +163,7 @@ nmbclusters_limit(void)
max_size = MIN(max_size, NMBCLUSTERS_MAX);
#endif
-#ifdef NMBCLUSTERS
- return MIN(max_size, NMBCLUSTERS);
-#else
return max_size;
-#endif
}
/*
@@ -197,7 +193,7 @@ mbinit(void)
* Set an arbitrary default limit on the number of mbuf clusters.
*/
#ifdef NMBCLUSTERS
- nmbclusters = nmbclusters_limit();
+ nmbclusters = MIN(NMBCLUSTERS, nmbclusters_limit());
#else
nmbclusters = MAX(1024,
(vsize_t)physmem * PAGE_SIZE / MCLBYTES / 16);