It's now possible for sbcompress() to compact mbuf clusters, so do it.
This helps prevent mbuf cluster exhaustion when receiving lots of small packets.
This commit is contained in:
parent
439a6c4942
commit
545d8679c0
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: uipc_socket2.c,v 1.30 1999/07/01 08:12:47 itojun Exp $ */
|
/* $NetBSD: uipc_socket2.c,v 1.31 1999/08/04 21:30:12 mycroft Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1988, 1990, 1993
|
* Copyright (c) 1982, 1986, 1988, 1990, 1993
|
||||||
@ -676,9 +676,11 @@ sbcompress(sb, m, n)
|
|||||||
m = m_free(m);
|
m = m_free(m);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 &&
|
if (n && (n->m_flags & M_EOR) == 0 && n->m_type == m->m_type &&
|
||||||
(n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] &&
|
(((n->m_flags & M_EXT) == 0 &&
|
||||||
n->m_type == m->m_type) {
|
n->m_data + n->m_len + m->m_len < &n->m_dat[MLEN]) ||
|
||||||
|
((~n->m_flags & (M_EXT|M_CLUSTER)) == 0 &&
|
||||||
|
n->m_data + n->m_len + m->m_len < &n->m_ext.ext_buf[MCLBYTES]))) {
|
||||||
memcpy(mtod(n, caddr_t) + n->m_len, mtod(m, caddr_t),
|
memcpy(mtod(n, caddr_t) + n->m_len, mtod(m, caddr_t),
|
||||||
(unsigned)m->m_len);
|
(unsigned)m->m_len);
|
||||||
n->m_len += m->m_len;
|
n->m_len += m->m_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user