summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-18 20:43:07 +0000
committerwollman <wollman@FreeBSD.org>1997-02-18 20:43:07 +0000
commit348a992441e4cfa6fff7a76bd128868ccc008872 (patch)
tree42867fb3be45df5695638f4334b3466cd51c6e75 /sys/kern/uipc_mbuf.c
parenta7fe8a4f0755bc16cc827cc40c168fbaf65f9dee (diff)
downloadFreeBSD-src-348a992441e4cfa6fff7a76bd128868ccc008872.zip
FreeBSD-src-348a992441e4cfa6fff7a76bd128868ccc008872.tar.gz
uipc_mbuf.c: do a better job of counting how often we have to wait
for memory, or are denied a cluster. uipc_socket2.c: define some generic ``operation-not-supported'' entry points for pr_usrreqs.
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index d2cb6c0..b816740 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
- * $FreeBSD$
+ * $Id$
*/
#include <sys/param.h>
@@ -118,7 +118,12 @@ m_mballoc(nmb, nowait)
return (0);
nbytes = round_page(nmb * MSIZE);
- p = (caddr_t)kmem_malloc(mb_map, nbytes, nowait ? M_NOWAIT : M_WAITOK);
+ p = (caddr_t)kmem_malloc(mb_map, nbytes, M_NOWAIT);
+ if (p == 0 && !nowait) {
+ mbstat.m_wait++;
+ p = (caddr_t)kmem_malloc(mb_map, nbytes, M_WAITOK);
+ }
+
/*
* Either the map is now full, or this is nowait and there
* are no pages left.
@@ -137,9 +142,9 @@ m_mballoc(nmb, nowait)
}
#if MCLBYTES > PAGE_SIZE
-int i_want_my_mcl;
+static int i_want_my_mcl;
-void
+static void
kproc_mclalloc(void)
{
int status;
@@ -184,13 +189,16 @@ m_clalloc(ncl, nowait)
* to get any more (nothing is ever freed back to the
* map).
*/
- if (mb_map_full)
+ if (mb_map_full) {
+ mbstat.m_drops++;
return (0);
+ }
#if MCLBYTES > PAGE_SIZE
if (nowait) {
i_want_my_mcl += ncl;
wakeup(&i_want_my_mcl);
+ mbstat.m_wait++;
p = 0;
} else {
p = contigmalloc1(MCLBYTES * ncl, M_DEVBUF, M_WAITOK, 0ul,
@@ -206,8 +214,10 @@ m_clalloc(ncl, nowait)
* Either the map is now full, or this is nowait and there
* are no pages left.
*/
- if (p == NULL)
+ if (p == NULL) {
+ mbstat.m_drops++;
return (0);
+ }
for (i = 0; i < ncl; i++) {
((union mcluster *)p)->mcl_next = mclfree;
OpenPOWER on IntegriCloud