Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 1995 16:26:51 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        davidg@Root.COM, guido@gvr.win.tue.nl
Cc:        Andrew@dca.net, bugs@FreeBSD.org
Subject:   Re: (fwd) "kernel: mb_map full" crash (fwd)
Message-ID:  <199507020626.QAA02585@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>    It's caused by an insufficient number of mbuf clusters being available. You
>> can increase the mbuf cluster pool size with options "NMBCLUSTERS=1024" (or
>> 2048 or whatever if necessary; each cluster takes 2K of memory). Newer
>> versions of FreeBSD (including 2.0.5R), have a more dynamic calculation for
>> this which is based on maxusers.

>Is it known why this crashes the machine? The code itsself seems to dynamically
>adjust the number of mbufs when it's out of mbuf space. I recently

In 2.0 it crashes because m_clalloc() sometimes calls kmem_malloc()
with the M_WAITOK flag immediately after the last fragment in mb_map has
been allocated.  This situation was considered unrecoverable and
kmem_malloc() paniced.  Now kmem_malloc() handles mb_map specially.
This works because all callers that allocate from mb_map (actually there
is only one such caller) are prepared to deal with the map filling up.
Othertimes the critical call to kmem_malloc() is done with the M_NOWAIT
flag and then the situation is recoverable without any kludges and
doesn't occur again because m_clalloc() knows that the map is full and
doesn't try to allocate any more from it.

>spotted a SunOS 4.1.4 (or what is the latest 4.1.y version) also behaves
>badly when it printf's the message that it's had to drop a packet because
>of an mbuf shortage. Btw: untill it does the printf, it seems the number
>of mbufs is succesfully increased.

In both 2.0 and 2.0.5., the number of mbufs is increased until mb_map
fills up.  mb_map has a size of (nmbclusters * 4096) bytes.  In -current,
nmbclusters defaults to (512 + MAXUSERS * 16).  Pages in mb_map are
never released, so several MB (default > 2MB) of real memory may be
wasted most of the time.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507020626.QAA02585>