Pull up following revision(s) (requested by msaitoh in ticket #1368):

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.
This commit is contained in:
martin 2021-10-25 15:47:50 +00:00
parent 70de6ba558
commit 05d44060d0
3 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: options.4,v 1.506.2.1 2019/09/05 09:00:22 martin Exp $
.\" $NetBSD: options.4,v 1.506.2.2 2021/10/25 15:47:50 martin Exp $
.\"
.\" Copyright (c) 1996
.\" Perry E. Metzger. All rights reserved.
@ -2082,15 +2082,20 @@ Mbuf clusters are MCLBYTES in size (usually 2k).
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

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1237.2.5 2020/03/08 10:18:04 martin Exp $
# $NetBSD: files,v 1.1237.2.6 2021/10/25 15:47:50 martin Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@ -285,6 +285,7 @@ defflag opt_pppoe.h PPPOE_SERVER PPPOE_DEBUG
#
defflag GATEWAY
defparam opt_nmbclusters.h NMBCLUSTERS
NMBCLUSTERS_MAX
defparam SB_MAX
# file system options

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_mbuf.c,v 1.232.4.1 2020/08/11 17:14:21 martin Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.232.4.2 2021/10/25 15:47:50 martin 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.232.4.1 2020/08/11 17:14:21 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.232.4.2 2021/10/25 15:47:50 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_mbuftrace.h"
@ -165,11 +165,7 @@ nmbclusters_limit(void)
max_size = MIN(max_size, NMBCLUSTERS_MAX);
#endif
#ifdef NMBCLUSTERS
return MIN(max_size, NMBCLUSTERS);
#else
return max_size;
#endif
}
/*
@ -199,7 +195,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);