FreeBSD kernel kern code
kern_mbuf.c File Reference
#include <sys/cdefs.h>
#include "opt_param.h"
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/protosw.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#include <vm/vm_map.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
#include <vm/uma_dbg.h>
Include dependency graph for kern_mbuf.c:

Go to the source code of this file.

Functions

 __FBSDID ("$BSDSUniX$")
 
 SYSCTL_QUAD (_kern_ipc, OID_AUTO, maxmbufmem, CTLFLAG_RDTUN,&maxmbufmem, 0,"Maximum real memory allocateable to various mbuf types")
 
static void tunable_mbinit (void *dummy)
 
 SYSINIT (tunable_mbinit, SI_SUB_KMEM, SI_ORDER_MIDDLE, tunable_mbinit, NULL)
 
static int sysctl_nmbclusters (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_ipc, OID_AUTO, nmbclusters, CTLTYPE_INT|CTLFLAG_RW,&nmbclusters, 0, sysctl_nmbclusters,"IU","Maximum number of mbuf clusters allowed")
 
static int sysctl_nmbjumbop (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_ipc, OID_AUTO, nmbjumbop, CTLTYPE_INT|CTLFLAG_RW,&nmbjumbop, 0, sysctl_nmbjumbop,"IU","Maximum number of mbuf page size jumbo clusters allowed")
 
static int sysctl_nmbjumbo9 (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_ipc, OID_AUTO, nmbjumbo9, CTLTYPE_INT|CTLFLAG_RW,&nmbjumbo9, 0, sysctl_nmbjumbo9,"IU","Maximum number of mbuf 9k jumbo clusters allowed")
 
static int sysctl_nmbjumbo16 (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_ipc, OID_AUTO, nmbjumbo16, CTLTYPE_INT|CTLFLAG_RW,&nmbjumbo16, 0, sysctl_nmbjumbo16,"IU","Maximum number of mbuf 16k jumbo clusters allowed")
 
static int sysctl_nmbufs (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_ipc, OID_AUTO, nmbufs, CTLTYPE_INT|CTLFLAG_RW,&nmbufs, 0, sysctl_nmbufs,"IU","Maximum number of mbufs allowed")
 
 SYSCTL_STRUCT (_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD,&mbstat, mbstat,"Mbuf general information and statistics")
 
static int mb_ctor_mbuf (void *, int, void *, int)
 
static int mb_ctor_clust (void *, int, void *, int)
 
static int mb_ctor_pack (void *, int, void *, int)
 
static void mb_dtor_mbuf (void *, int, void *)
 
static void mb_dtor_clust (void *, int, void *)
 
static void mb_dtor_pack (void *, int, void *)
 
static int mb_zinit_pack (void *, int, int)
 
static void mb_zfini_pack (void *, int)
 
static void mb_reclaim (void *)
 
static void * mbuf_jumbo_alloc (uma_zone_t, int, uint8_t *, int)
 
 CTASSERT ((((MSIZE-1)^MSIZE)+1) >> 1==MSIZE)
 
static void mbuf_init (void *dummy)
 
 SYSINIT (mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL)
 
int m_pkthdr_init (struct mbuf *m, int how)
 

Variables

int nmbufs
 
int nmbclusters
 
int nmbjumbop
 
int nmbjumbo9
 
int nmbjumbo16
 
struct mbstat mbstat
 
static quad_t maxmbufmem
 
uma_zone_t zone_mbuf
 
uma_zone_t zone_clust
 
uma_zone_t zone_pack
 
uma_zone_t zone_jumbop
 
uma_zone_t zone_jumbo9
 
uma_zone_t zone_jumbo16
 
uma_zone_t zone_ext_refcnt
 

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
CTASSERT ( (((MSIZE-1)^MSIZE)+1) >>  1 = =MSIZE)
int m_pkthdr_init ( struct mbuf *  m,
int  how 
)

Definition at line 707 of file kern_mbuf.c.

static int mb_ctor_clust ( void *  mem,
int  size,
void *  arg,
int  how 
)
static

Definition at line 546 of file kern_mbuf.c.

References panic(), type, zone_clust, zone_jumbo16, zone_jumbo9, and zone_jumbop.

Referenced by mbuf_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static int mb_ctor_mbuf ( void *  mem,
int  size,
void *  arg,
int  how 
)
static

Definition at line 428 of file kern_mbuf.c.

References type.

Referenced by mbuf_init().

Here is the caller graph for this function:

static int mb_ctor_pack ( void *  mem,
int  size,
void *  arg,
int  how 
)
static

Definition at line 659 of file kern_mbuf.c.

References type.

Referenced by mbuf_init().

Here is the caller graph for this function:

static void mb_dtor_clust ( void *  mem,
int  size,
void *  arg 
)
static

Definition at line 602 of file kern_mbuf.c.

Referenced by mbuf_init().

Here is the caller graph for this function:

static void mb_dtor_mbuf ( void *  mem,
int  size,
void *  arg 
)
static

Definition at line 484 of file kern_mbuf.c.

References m_tag_delete_chain().

Referenced by mbuf_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void mb_dtor_pack ( void *  mem,
int  size,
void *  arg 
)
static

Definition at line 505 of file kern_mbuf.c.

References m_tag_delete_chain(), zone_clust, and zone_pack.

Referenced by mbuf_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void mb_reclaim ( void *  junk)
static

Definition at line 740 of file kern_mbuf.c.

References domains, and pr.

Referenced by mbuf_init().

Here is the caller graph for this function:

static void mb_zfini_pack ( void *  mem,
int  size 
)
static

Definition at line 641 of file kern_mbuf.c.

References zone_clust.

Referenced by mbuf_init().

Here is the caller graph for this function:

static int mb_zinit_pack ( void *  mem,
int  size,
int  how 
)
static

Definition at line 621 of file kern_mbuf.c.

References zone_clust.

Referenced by mbuf_init().

Here is the caller graph for this function:

static void * mbuf_jumbo_alloc ( uma_zone_t  zone,
int  bytes,
uint8_t *  flags,
int  wait 
)
static

Definition at line 411 of file kern_mbuf.c.

Referenced by mbuf_init().

Here is the caller graph for this function:

static int sysctl_nmbclusters ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 160 of file kern_mbuf.c.

References nmbclusters, nmbjumbo16, nmbjumbo9, nmbjumbop, nmbufs, sysctl_handle_int(), and zone_clust.

Here is the call graph for this function:

static int sysctl_nmbjumbo16 ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 224 of file kern_mbuf.c.

References nmbclusters, nmbjumbo16, nmbjumbo9, nmbjumbop, nmbufs, sysctl_handle_int(), and zone_jumbo16.

Here is the call graph for this function:

static int sysctl_nmbjumbo9 ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 203 of file kern_mbuf.c.

References nmbclusters, nmbjumbo16, nmbjumbo9, nmbjumbop, nmbufs, sysctl_handle_int(), and zone_jumbo9.

Here is the call graph for this function:

static int sysctl_nmbjumbop ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 182 of file kern_mbuf.c.

References nmbclusters, nmbjumbo16, nmbjumbo9, nmbjumbop, nmbufs, sysctl_handle_int(), and zone_jumbop.

Here is the call graph for this function:

static int sysctl_nmbufs ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 245 of file kern_mbuf.c.

References nmbufs, sysctl_handle_int(), and zone_mbuf.

Here is the call graph for this function:

SYSCTL_PROC ( _kern_ipc  ,
OID_AUTO  ,
nmbclusters  ,
CTLTYPE_INT|  CTLFLAG_RW,
nmbclusters,
,
sysctl_nmbclusters  ,
"IU"  ,
"Maximum number of mbuf clusters allowed"   
)
SYSCTL_PROC ( _kern_ipc  ,
OID_AUTO  ,
nmbjumbop  ,
CTLTYPE_INT|  CTLFLAG_RW,
nmbjumbop,
,
sysctl_nmbjumbop  ,
"IU"  ,
"Maximum number of mbuf page size jumbo clusters allowed"   
)
SYSCTL_PROC ( _kern_ipc  ,
OID_AUTO  ,
nmbjumbo9  ,
CTLTYPE_INT|  CTLFLAG_RW,
nmbjumbo9,
,
sysctl_nmbjumbo9  ,
"IU"  ,
"Maximum number of mbuf 9k jumbo clusters allowed"   
)
SYSCTL_PROC ( _kern_ipc  ,
OID_AUTO  ,
nmbjumbo16  ,
CTLTYPE_INT|  CTLFLAG_RW,
nmbjumbo16,
,
sysctl_nmbjumbo16  ,
"IU"  ,
"Maximum number of mbuf 16k jumbo clusters allowed"   
)
SYSCTL_PROC ( _kern_ipc  ,
OID_AUTO  ,
nmbufs  ,
CTLTYPE_INT|  CTLFLAG_RW,
nmbufs,
,
sysctl_nmbufs  ,
"IU"  ,
"Maximum number of mbufs allowed"   
)
SYSCTL_QUAD ( _kern_ipc  ,
OID_AUTO  ,
maxmbufmem  ,
CTLFLAG_RDTUN  ,
maxmbufmem,
,
"Maximum real memory allocateable to various mbuf types"   
)
SYSCTL_STRUCT ( _kern_ipc  ,
OID_AUTO  ,
mbstat  ,
CTLFLAG_RD  ,
mbstat,
mbstat  ,
"Mbuf general information and statistics"   
)
SYSINIT ( tunable_mbinit  ,
SI_SUB_KMEM  ,
SI_ORDER_MIDDLE  ,
tunable_mbinit  ,
NULL   
)
SYSINIT ( mbuf  ,
SI_SUB_MBUF  ,
SI_ORDER_FIRST  ,
mbuf_init  ,
NULL   
)
static void tunable_mbinit ( void *  dummy)
static

Definition at line 116 of file kern_mbuf.c.

References maxmbufmem, nmbclusters, nmbjumbo16, nmbjumbo9, nmbjumbop, and nmbufs.

Variable Documentation

quad_t maxmbufmem
static

Definition at line 107 of file kern_mbuf.c.

Referenced by tunable_mbinit().

struct mbstat mbstat

Definition at line 105 of file kern_mbuf.c.

Referenced by kern_sendfile(), m_copym(), m_copypacket(), m_dup(), m_pullup(), and mbuf_init().

uma_zone_t zone_clust
uma_zone_t zone_ext_refcnt

Definition at line 277 of file kern_mbuf.c.

Referenced by m_extadd(), mb_free_ext(), and mbuf_init().

uma_zone_t zone_jumbo16

Definition at line 276 of file kern_mbuf.c.

Referenced by mb_ctor_clust(), mb_free_ext(), mbuf_init(), and sysctl_nmbjumbo16().

uma_zone_t zone_jumbo9

Definition at line 275 of file kern_mbuf.c.

Referenced by mb_ctor_clust(), mb_free_ext(), mbuf_init(), and sysctl_nmbjumbo9().

uma_zone_t zone_jumbop

Definition at line 274 of file kern_mbuf.c.

Referenced by mb_ctor_clust(), mb_free_ext(), mbuf_init(), and sysctl_nmbjumbop().

uma_zone_t zone_mbuf

Definition at line 271 of file kern_mbuf.c.

Referenced by mb_free_ext(), mbuf_init(), and sysctl_nmbufs().

uma_zone_t zone_pack

Definition at line 273 of file kern_mbuf.c.

Referenced by mb_dtor_pack(), mb_free_ext(), and mbuf_init().