kern_mbuf.c (132987) | kern_mbuf.c (135510) |
---|---|
1/*- 2 * Copyright (c) 2004 3 * Bosko Milekic <bmilekic@FreeBSD.org>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 3 * Bosko Milekic <bmilekic@FreeBSD.org>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 132987 2004-08-02 00:18:36Z green $"); | 33__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 135510 2004-09-20 08:52:04Z brian $"); |
34 35#include "opt_mac.h" 36#include "opt_param.h" 37 38#include <sys/param.h> 39#include <sys/mac.h> 40#include <sys/malloc.h> 41#include <sys/systm.h> --- 76 unchanged lines hidden (view full) --- 118static void mb_dtor_clust(void *, int, void *); /* XXX */ 119static void mb_dtor_pack(void *, int, void *); /* XXX */ 120static int mb_init_pack(void *, int, int); 121static void mb_fini_pack(void *, int); 122 123static void mb_reclaim(void *); 124static void mbuf_init(void *); 125 | 34 35#include "opt_mac.h" 36#include "opt_param.h" 37 38#include <sys/param.h> 39#include <sys/mac.h> 40#include <sys/malloc.h> 41#include <sys/systm.h> --- 76 unchanged lines hidden (view full) --- 118static void mb_dtor_clust(void *, int, void *); /* XXX */ 119static void mb_dtor_pack(void *, int, void *); /* XXX */ 120static int mb_init_pack(void *, int, int); 121static void mb_fini_pack(void *, int); 122 123static void mb_reclaim(void *); 124static void mbuf_init(void *); 125 |
126/* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */ 127CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); 128 |
|
126/* 127 * Initialize FreeBSD Network buffer allocation. 128 */ 129SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL) 130static void 131mbuf_init(void *dummy) 132{ 133 134 /* 135 * Configure UMA zones for Mbufs, Clusters, and Packets. 136 */ 137 zone_mbuf = uma_zcreate("Mbuf", MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, | 129/* 130 * Initialize FreeBSD Network buffer allocation. 131 */ 132SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL) 133static void 134mbuf_init(void *dummy) 135{ 136 137 /* 138 * Configure UMA zones for Mbufs, Clusters, and Packets. 139 */ 140 zone_mbuf = uma_zcreate("Mbuf", MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, |
138 NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_MAXBUCKET); | 141 NULL, NULL, MSIZE - 1, UMA_ZONE_MAXBUCKET); |
139 zone_clust = uma_zcreate("MbufClust", MCLBYTES, mb_ctor_clust, 140 mb_dtor_clust, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_REFCNT); 141 if (nmbclusters > 0) 142 uma_zone_set_max(zone_clust, nmbclusters); 143 zone_pack = uma_zsecond_create("Packet", mb_ctor_pack, mb_dtor_pack, 144 mb_init_pack, mb_fini_pack, zone_mbuf); 145 146 /* uma_prealloc() goes here */ --- 234 unchanged lines hidden --- | 142 zone_clust = uma_zcreate("MbufClust", MCLBYTES, mb_ctor_clust, 143 mb_dtor_clust, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_REFCNT); 144 if (nmbclusters > 0) 145 uma_zone_set_max(zone_clust, nmbclusters); 146 zone_pack = uma_zsecond_create("Packet", mb_ctor_pack, mb_dtor_pack, 147 mb_init_pack, mb_fini_pack, zone_mbuf); 148 149 /* uma_prealloc() goes here */ --- 234 unchanged lines hidden --- |