Deleted Added
full compact
kern_mbuf.c (155780) kern_mbuf.c (156023)
1/*-
2 * Copyright (c) 2004, 2005,
3 * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004, 2005,
3 * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 155780 2006-02-17 14:14:15Z andre $");
29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 156023 2006-02-26 11:44:28Z glebius $");
30
31#include "opt_mac.h"
32#include "opt_param.h"
33
34#include <sys/param.h>
35#include <sys/mac.h>
36#include <sys/malloc.h>
37#include <sys/systm.h>

--- 31 unchanged lines hidden (view full) ---

69 * m_clget() m_getcl()
70 * | |
71 * | .------------>[(Packet Cache)] m_get(), m_gethdr()
72 * | | [ Packet ] |
73 * [(Cluster Cache)] [ Secondary ] [ (Mbuf Cache) ]
74 * [ Cluster Zone ] [ Zone ] [ Mbuf Master Zone ]
75 * | \________ |
76 * [ Cluster Keg ] \ /
30
31#include "opt_mac.h"
32#include "opt_param.h"
33
34#include <sys/param.h>
35#include <sys/mac.h>
36#include <sys/malloc.h>
37#include <sys/systm.h>

--- 31 unchanged lines hidden (view full) ---

69 * m_clget() m_getcl()
70 * | |
71 * | .------------>[(Packet Cache)] m_get(), m_gethdr()
72 * | | [ Packet ] |
73 * [(Cluster Cache)] [ Secondary ] [ (Mbuf Cache) ]
74 * [ Cluster Zone ] [ Zone ] [ Mbuf Master Zone ]
75 * | \________ |
76 * [ Cluster Keg ] \ /
77 * | [ Mbuf Keg ]
77 * | [ Mbuf Keg ]
78 * [ Cluster Slabs ] |
79 * | [ Mbuf Slabs ]
80 * \____________(VM)_________________/
81 *
82 *
78 * [ Cluster Slabs ] |
79 * | [ Mbuf Slabs ]
80 * \____________(VM)_________________/
81 *
82 *
83 * Whenever a object is allocated with uma_zalloc() out of the
83 * Whenever an object is allocated with uma_zalloc() out of
84 * one of the Zones its _ctor_ function is executed. The same
84 * one of the Zones its _ctor_ function is executed. The same
85 * for any deallocation through uma_zfree() the _dror_ function
85 * for any deallocation through uma_zfree() the _dtor_ function
86 * is executed.
86 * is executed.
87 *
87 *
88 * Caches are per-CPU and are filled from the Master Zone.
89 *
88 * Caches are per-CPU and are filled from the Master Zone.
89 *
90 * Whenever a object is allocated from the underlying global
90 * Whenever an object is allocated from the underlying global
91 * memory pool it gets pre-initialized with the _zinit_ functions.
92 * When the Keg's are overfull objects get decomissioned with
93 * _zfini_ functions and free'd back to the global memory pool.
94 *
95 */
96
97int nmbclusters; /* limits number of mbuf clusters */
98int nmbjumbop; /* limits number of page size jumbo clusters */

--- 84 unchanged lines hidden (view full) ---

183#endif
184 UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
185 if (nmbclusters > 0)
186 uma_zone_set_max(zone_clust, nmbclusters);
187
188 zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack,
189 mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf);
190
91 * memory pool it gets pre-initialized with the _zinit_ functions.
92 * When the Keg's are overfull objects get decomissioned with
93 * _zfini_ functions and free'd back to the global memory pool.
94 *
95 */
96
97int nmbclusters; /* limits number of mbuf clusters */
98int nmbjumbop; /* limits number of page size jumbo clusters */

--- 84 unchanged lines hidden (view full) ---

183#endif
184 UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
185 if (nmbclusters > 0)
186 uma_zone_set_max(zone_clust, nmbclusters);
187
188 zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack,
189 mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf);
190
191 /* Make jumbo frame zone too. 4k, 9k and 16k. */
191 /* Make jumbo frame zone too. Page size, 9k and 16k. */
192 zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE,
193 mb_ctor_clust, mb_dtor_clust,
194#ifdef INVARIANTS
195 trash_init, trash_fini,
196#else
197 NULL, NULL,
198#endif
199 UMA_ALIGN_PTR, UMA_ZONE_REFCNT);

--- 86 unchanged lines hidden (view full) ---

286#endif
287 m = (struct mbuf *)mem;
288 args = (struct mb_args *)arg;
289 flags = args->flags;
290 type = args->type;
291
292 /*
293 * The mbuf is initialized later. The caller has the
192 zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE,
193 mb_ctor_clust, mb_dtor_clust,
194#ifdef INVARIANTS
195 trash_init, trash_fini,
196#else
197 NULL, NULL,
198#endif
199 UMA_ALIGN_PTR, UMA_ZONE_REFCNT);

--- 86 unchanged lines hidden (view full) ---

286#endif
287 m = (struct mbuf *)mem;
288 args = (struct mb_args *)arg;
289 flags = args->flags;
290 type = args->type;
291
292 /*
293 * The mbuf is initialized later. The caller has the
294 * responseability to setup any MAC labels too.
294 * responsibility to setup any MAC labels too.
295 */
296 if (type == MT_NOINIT)
297 return (0);
298
299 m->m_next = NULL;
300 m->m_nextpkt = NULL;
301 m->m_len = 0;
302 m->m_flags = flags;

--- 257 unchanged lines hidden ---
295 */
296 if (type == MT_NOINIT)
297 return (0);
298
299 m->m_next = NULL;
300 m->m_nextpkt = NULL;
301 m->m_len = 0;
302 m->m_flags = flags;

--- 257 unchanged lines hidden ---