/bsd: WARNING: mclpools limit reached; increase kern.maxclusters

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jordi Espasa Clofent
Date: Friday, May 21, 2010 - 4:40 am

Hi all,

As the subject says, I've found a few lines like that in /var/log/messages:

[...]
/bsd: WARNING: mclpools limit reached; increase kern.maxclusters
[...]

The box is a 4.6 -STABLE with PF doing FW functions (moving 300/400Mbps) 
and always has worked like a charm.

I've noticed when these kind of message appears, the systems suffers 
little micro-dowtime in the network.

I've searched the mail archives and it's the expected behaviour: if you 
haven't any nmbcluster free, you haven't any mbuf and, because of that, 
network doesn't work temporaly. Henning explains here:
http://marc.info/?l=openbsd-misc&m=126745163232328&w=2

Moreover I've found the code:
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/kern/uipc_mbuf.c

[...]
struct	pool mclpools[MCLPOOLS];

int	m_clpool(u_int);

int max_linkhdr;		/* largest link-level header */
int max_protohdr;		/* largest protocol header */
int max_hdr;			/* largest link+protocol header */
int max_datalen;		/* MHLEN - max_hdr */

struct timeout m_cltick_tmo;
int	m_clticks;
void	m_cltick(void *);

void	m_extfree(struct mbuf *);
struct mbuf *m_copym0(struct mbuf *, int, int, int, int);
void	nmbclust_update(void);


const char *mclpool_warnmsg =
     "WARNING: mclpools limit reached; increase kern.maxclusters";

/*
  * Initialize the mbuf allocator.
  */
void
mbinit(void)
{
	int i;

	pool_init(&mbpool, MSIZE, 0, 0, 0, "mbpl", NULL);
	pool_setlowat(&mbpool, mblowat);

	for (i = 0; i < nitems(mclsizes); i++) {
		snprintf(mclnames[i], sizeof(mclnames[0]), "mcl%dk",
		    mclsizes[i] >> 10);
		pool_init(&mclpools[i], mclsizes[i], 0, 0, 0, mclnames[i],
		    NULL);
		pool_setlowat(&mclpools[i], mcllowat);
	}

	nmbclust_update();

	timeout_set(&m_cltick_tmo, m_cltick, NULL);
	m_cltick(NULL);
}

void
nmbclust_update(void)
{
	int i;
	/*
	 * Set the hard limit on the mclpools to the number of
	 * mbuf clusters the kernel is to support.  Log the limit
	 * reached message max once a minute.
	 */
	for (i = 0; i < nitems(mclsizes); i++) {
		(void)pool_sethardlimit(&mclpools[i], nmbclust,
		    mclpool_warnmsg, 60);
	}
	pool_sethiwat(&mbpool, nmbclust);
}

[...]

When you reach the mbuf cluster available, nmbclust_update() inserts the 
mclpool_warnmsg string in /var/log/message.

That's fine and clear. The problem here is:

?why a system that normally uses (according symon graphs) 80/120 mbuf 
clusters needs 8/10K nmbcluster sometimes?

At present I've done a simple workaround:

# cat /etc/sysctl.conf | grep -i cluster 
 

kern.maxclusters=16384

but I wonder the real reasons for this nmbcluster increment.

?How can I debug it?

Thanks.

-- 
I must not fear. Fear is the mind-killer. Fear is the little-death that 
brings total obliteration. I will face my fear. I will permit it to pass 
over me and through me. And when it has gone past I will turn the inner 
eye to see its path. Where the fear has gone there will be nothing. Only 
I will remain.

Bene Gesserit Litany Against Fear.

-- 
I must not fear. Fear is the mind-killer. Fear is the little-death that 
brings total obliteration. I will face my fear. I will permit it to pass 
over me and through me. And when it has gone past I will turn the inner 
eye to see its path. Where the fear has gone there will be nothing. Only 
I will remain.

Bene Gesserit Litany Against Fear.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
/bsd: WARNING: mclpools limit reached; increase kern.maxcl ..., Jordi Espasa Clofent, (Fri May 21, 4:40 am)