summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mbuf.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-06-18 17:59:04 +0000
committeralc <alc@FreeBSD.org>2009-06-18 17:59:04 +0000
commit32a3828c705bbe3ff21c3fd2241f6cf76f1e441f (patch)
tree53b7ff35c71b2100dea56973cd5cfc1178575076 /sys/kern/kern_mbuf.c
parentee4de3e44a17a3ff08159350eea8f7c94dd1e5d7 (diff)
downloadFreeBSD-src-32a3828c705bbe3ff21c3fd2241f6cf76f1e441f.zip
FreeBSD-src-32a3828c705bbe3ff21c3fd2241f6cf76f1e441f.tar.gz
Utilize the new function kmem_alloc_contig() to implement the UMA back-end
allocator for the jumbo frames zones. This change has two benefits: (1) a custom back-end deallocator is no longer required. UMA's standard deallocator suffices. (2) It eliminates a potentially confusing artifact of using contigmalloc(): The malloc(9) statistics contain bogus information about the usage of jumbo frames. Specifically, the malloc(9) statistics report all jumbo frames in use whereas the UMA zone statistics report the "truth" about the number in use vs. the number free.
Diffstat (limited to 'sys/kern/kern_mbuf.c')
-rw-r--r--sys/kern/kern_mbuf.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index 58fa314..80274ed 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
#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/uma.h>
#include <vm/uma_int.h>
@@ -232,9 +234,6 @@ static void mb_zfini_pack(void *, int);
static void mb_reclaim(void *);
static void mbuf_init(void *);
static void *mbuf_jumbo_alloc(uma_zone_t, int, u_int8_t *, int);
-static void mbuf_jumbo_free(void *, int, u_int8_t);
-
-static MALLOC_DEFINE(M_JUMBOFRAME, "jumboframes", "mbuf jumbo frame buffers");
/* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */
CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE);
@@ -296,7 +295,6 @@ mbuf_init(void *dummy)
if (nmbjumbo9 > 0)
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc);
- uma_zone_set_freef(zone_jumbo9, mbuf_jumbo_free);
zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES,
mb_ctor_clust, mb_dtor_clust,
@@ -309,7 +307,6 @@ mbuf_init(void *dummy)
if (nmbjumbo16 > 0)
uma_zone_set_max(zone_jumbo16, nmbjumbo16);
uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc);
- uma_zone_set_freef(zone_jumbo16, mbuf_jumbo_free);
zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int),
NULL, NULL,
@@ -358,18 +355,8 @@ mbuf_jumbo_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
/* Inform UMA that this allocator uses kernel_map/object. */
*flags = UMA_SLAB_KERNEL;
- return (contigmalloc(bytes, M_JUMBOFRAME, wait, (vm_paddr_t)0,
- ~(vm_paddr_t)0, 1, 0));
-}
-
-/*
- * UMA backend page deallocator for the jumbo frame zones.
- */
-static void
-mbuf_jumbo_free(void *mem, int size, u_int8_t flags)
-{
-
- contigfree(mem, size, M_JUMBOFRAME);
+ return ((void *)kmem_alloc_contig(kernel_map, bytes, wait,
+ (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0));
}
/*
OpenPOWER on IntegriCloud