Replace the 4k fixed sized jumbo mbuf clusters with PAGE_SIZE sized

jumbo mbuf clusters.  To make the variable size clear they are named
MJUMPAGESIZE.

Having jumbo clusters with the native PAGE_SIZE is more useful than
a fixed 4k size according the device driver writers using this API.

The 9k and 16k jumbo mbuf clusters remain unchanged.

Requested by:	glebius, gallatin
Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days
This commit is contained in:
Andre Oppermann 2006-02-17 14:14:15 +00:00
parent 608e65bb2a
commit ec63cb90a3
4 changed files with 25 additions and 25 deletions

View File

@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$");
*/
int nmbclusters; /* limits number of mbuf clusters */
int nmbjumbo4; /* limits number of 4k jumbo clusters */
int nmbjumbop; /* limits number of page size jumbo clusters */
int nmbjumbo9; /* limits number of 9k jumbo clusters */
int nmbjumbo16; /* limits number of 16k jumbo clusters */
struct mbstat mbstat;
@ -114,8 +114,8 @@ SYSCTL_DECL(_kern_ipc);
/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
SYSCTL_INT(_kern_ipc, OID_AUTO, nmbclusters, CTLFLAG_RW, &nmbclusters, 0,
"Maximum number of mbuf clusters allowed");
SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbo4, CTLFLAG_RW, &nmbjumbo4, 0,
"Maximum number of mbuf 4k jumbo clusters allowed");
SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbop, CTLFLAG_RW, &nmbjumbop, 0,
"Maximum number of mbuf page size jumbo clusters allowed");
SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbo9, CTLFLAG_RW, &nmbjumbo9, 0,
"Maximum number of mbuf 9k jumbo clusters allowed");
SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbo16, CTLFLAG_RW, &nmbjumbo16, 0,
@ -129,7 +129,7 @@ SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat,
uma_zone_t zone_mbuf;
uma_zone_t zone_clust;
uma_zone_t zone_pack;
uma_zone_t zone_jumbo4;
uma_zone_t zone_jumbop;
uma_zone_t zone_jumbo9;
uma_zone_t zone_jumbo16;
uma_zone_t zone_ext_refcnt;
@ -189,7 +189,7 @@ mbuf_init(void *dummy)
mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf);
/* Make jumbo frame zone too. 4k, 9k and 16k. */
zone_jumbo4 = uma_zcreate(MBUF_JUMBO4_MEM_NAME, MJUM4BYTES,
zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE,
mb_ctor_clust, mb_dtor_clust,
#ifdef INVARIANTS
trash_init, trash_fini,
@ -197,8 +197,8 @@ mbuf_init(void *dummy)
NULL, NULL,
#endif
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbo4 > 0)
uma_zone_set_max(zone_jumbo4, nmbjumbo4);
if (nmbjumbop > 0)
uma_zone_set_max(zone_jumbop, nmbjumbop);
zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES,
mb_ctor_clust, mb_dtor_clust,
@ -363,7 +363,7 @@ mb_dtor_pack(void *mem, int size, void *arg)
}
/*
* The Cluster and Jumbo[9|16] zone constructor.
* The Cluster and Jumbo[PAGESIZE|9|16] zone constructor.
*
* Here the 'arg' pointer points to the Mbuf which we
* are configuring cluster storage for. If 'arg' is
@ -386,9 +386,9 @@ mb_ctor_clust(void *mem, int size, void *arg, int how)
case MCLBYTES:
type = EXT_CLUSTER;
break;
#if MJUM4BYTES != MCLBYTES
case MJUM4BYTES:
type = EXT_JUMBO4;
#if MJUMPAGESIZE != MCLBYTES
case MJUMPAGESIZE:
type = EXT_JUMBOP;
break;
#endif
case MJUM9BYTES:

View File

@ -225,8 +225,8 @@ mb_free_ext(struct mbuf *m)
case EXT_CLUSTER:
uma_zfree(zone_clust, m->m_ext.ext_buf);
break;
case EXT_JUMBO4:
uma_zfree(zone_jumbo4, m->m_ext.ext_buf);
case EXT_JUMBOP:
uma_zfree(zone_jumbop, m->m_ext.ext_buf);
break;
case EXT_JUMBO9:
uma_zfree(zone_jumbo9, m->m_ext.ext_buf);

View File

@ -185,7 +185,7 @@ struct mbuf {
*/
#define EXT_CLUSTER 1 /* mbuf cluster */
#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */
#define EXT_JUMBO4 3 /* jumbo cluster 4096 bytes */
#define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */
#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
@ -306,7 +306,7 @@ struct mbstat {
#define MBUF_MEM_NAME "mbuf"
#define MBUF_CLUSTER_MEM_NAME "mbuf_cluster"
#define MBUF_PACKET_MEM_NAME "mbuf_packet"
#define MBUF_JUMBO4_MEM_NAME "mbuf_jumbo_4k"
#define MBUF_JUMBOP_MEM_NAME "mbuf_jumbo_pagesize"
#define MBUF_JUMBO9_MEM_NAME "mbuf_jumbo_9k"
#define MBUF_JUMBO16_MEM_NAME "mbuf_jumbo_16k"
#define MBUF_TAG_MEM_NAME "mbuf_tag"
@ -333,7 +333,7 @@ struct mbstat {
extern uma_zone_t zone_mbuf;
extern uma_zone_t zone_clust;
extern uma_zone_t zone_pack;
extern uma_zone_t zone_jumbo4;
extern uma_zone_t zone_jumbop;
extern uma_zone_t zone_jumbo9;
extern uma_zone_t zone_jumbo16;
extern uma_zone_t zone_ext_refcnt;
@ -401,7 +401,7 @@ m_getcl(int how, short type, int flags)
/*
* m_getjcl() returns an mbuf with a cluster of the specified size attached.
* For size it takes MCLBYTES, MJUM4BYTES, MJUM9BYTES, MJUM16BYTES.
* For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
*/
static __inline /* XXX: This is rather large, should be real function maybe. */
struct mbuf *
@ -422,9 +422,9 @@ m_getjcl(int how, short type, int flags, int size)
case MCLBYTES:
zone = zone_clust;
break;
#if MJUM4BYTES != MCLBYTES
case MJUM4BYTES:
zone = zone_jumbo4;
#if MJUMPAGESIZE != MCLBYTES
case MJUMPAGESIZE:
zone = zone_jumbop;
break;
#endif
case MJUM9BYTES:
@ -473,7 +473,7 @@ m_clget(struct mbuf *m, int how)
* is the pointer to the cluster of the requested size. If an mbuf was
* specified, it gets the cluster attached to it and the return value
* can be safely ignored.
* For size it takes MCLBYTES, MJUM4BYTES, MJUM9BYTES, MJUM16BYTES.
* For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
*/
static __inline
void *
@ -490,9 +490,9 @@ m_cljget(struct mbuf *m, int how, int size)
case MCLBYTES:
zone = zone_clust;
break;
#if MJUM4BYTES != MCLBYTES
case MJUM4BYTES:
zone = zone_jumbo4;
#if MJUMPAGESIZE != MCLBYTES
case MJUMPAGESIZE:
zone = zone_jumbop;
break;
#endif
case MJUM9BYTES:

View File

@ -147,7 +147,7 @@
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
#define MJUM4BYTES (4 * 1024) /* jumbo cluster 4k */
#define MJUMPAGESIZE PAGE_SIZE /* jumbo cluster 4k */
#define MJUM9BYTES (9 * 1024) /* jumbo cluster 9k */
#define MJUM16BYTES (16 * 1024) /* jumbo cluster 16k */