summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-03-15 07:52:06 +0000
committerdg <dg@FreeBSD.org>1995-03-15 07:52:06 +0000
commitc20bdce1e09ff7c3db7910a8b0353fadb210e6f1 (patch)
treeaf7ab4a204150cd9c9da398ba2da8588c77fe968 /sys/kern/uipc_mbuf.c
parent876858a7b243e8839c039e1eb69306e19c0015dd (diff)
downloadFreeBSD-src-c20bdce1e09ff7c3db7910a8b0353fadb210e6f1.zip
FreeBSD-src-c20bdce1e09ff7c3db7910a8b0353fadb210e6f1.tar.gz
Special cased the handling of mb_map in the M_WAITOK case. kmem_malloc()
now returns NULL and sets a global 'mb_map_full' when the map is full. m_clalloc() has further been taught to expect this and do the right thing. This should fix the "mb_map full" panics that several people have reported.
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 55932c6..d71ff9f 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
- * $Id: uipc_mbuf.c,v 1.7 1995/02/05 07:08:27 bde Exp $
+ * $Id: uipc_mbuf.c,v 1.8 1995/02/23 19:10:21 davidg Exp $
*/
#include <sys/param.h>
@@ -50,6 +50,7 @@
extern vm_map_t mb_map;
struct mbuf *mbutl;
char *mclrefcnt;
+int mb_map_full;
void
mbinit()
@@ -86,16 +87,24 @@ m_clalloc(ncl, nowait)
register int i;
int npg;
+ /*
+ * Once we run out of map space, it will be impossible
+ * to get any more (nothing is ever freed back to the
+ * map).
+ */
+ if (mb_map_full)
+ return (0);
+
npg = ncl * CLSIZE;
p = (caddr_t)kmem_malloc(mb_map, ctob(npg),
nowait ? M_NOWAIT : M_WAITOK);
- if (p == NULL) {
- if (logged == 0) {
- logged++;
- log(LOG_ERR, "mb_map full\n");
- }
+ /*
+ * Either the map is now full, or this is nowait and there
+ * are no pages left.
+ */
+ if (p == NULL)
return (0);
- }
+
ncl = ncl * CLBYTES / MCLBYTES;
for (i = 0; i < ncl; i++) {
((union mcluster *)p)->mcl_next = mclfree;
OpenPOWER on IntegriCloud