diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-20 10:50:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-20 10:50:23 +0000 |
commit | 484d1065bcccebf78c33607c880632b6ef0d0370 (patch) | |
tree | 5bf5f5fba7740032a0f52773b7fbf09b94b7d89d /sys/kern/uipc_mbuf.c | |
parent | 2a15a5c53a44292d7a96ab2f102db1aaaf742783 (diff) |
if kmem_malloc() fails to allocate a cluster, call m_reclaim(). log
"mb_map full" message only once a minute.
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index f76c50a51a5..efd54f99140 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.2 1996/03/03 17:20:17 niklas Exp $ */ -/* $NetBSD: uipc_mbuf.c,v 1.15 1996/02/09 19:00:45 christos Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.3 1996/06/20 10:50:22 deraadt Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1991, 1993 @@ -79,19 +79,25 @@ m_clalloc(ncl, nowait) register int ncl; int nowait; { - static int logged; + volatile static struct timeval lastlogged; + struct timeval curtime, logdiff; register caddr_t p; register int i; - int npg; + int npg, s; npg = ncl * CLSIZE; p = (caddr_t)kmem_malloc(mb_map, ctob(npg), !nowait); if (p == NULL) { - if (logged == 0) { - logged++; + s = splclock(); + curtime = time; + splx(s); + timersub(&curtime, &lastlogged, &logdiff); + if (logdiff.tv_sec >= 60) { + lastlogged = curtime; log(LOG_ERR, "mb_map full\n"); } - return (0); + m_reclaim(); + return (mclfree != NULL); } ncl = ncl * CLBYTES / MCLBYTES; for (i = 0; i < ncl; i++) { |