From 3508d9a1bbe905315a2fb75ce50a2c2f06fc8740 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 26 Jul 2011 20:34:36 -0700 Subject: [PATCH] kernel - Adjust mbuf cached free object retention * Adjust the cache retention in the objcache_create() calls the mbuf subsystem makes to reduce burst ENOBUF failures. Previously the main mbufphdr cache only retained ~150 or so free mbufs. Now it retains up to 1/4 the limit. Reported-by: Peter Avalos --- sys/kern/uipc_mbuf.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index b34a8f01c3..440a7ea828 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -638,48 +638,56 @@ mbinit(void *dummy) mb_limit = cl_limit = 0; limit = nmbufs; - mbuf_cache = objcache_create("mbuf", &limit, 0, + mbuf_cache = objcache_create("mbuf", + &limit, 0, mbuf_ctor, NULL, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; limit = nmbufs; - mbufphdr_cache = objcache_create("mbuf pkt hdr", &limit, 128, + mbufphdr_cache = objcache_create("mbuf pkt hdr", + &limit, nmbufs / 4, mbufphdr_ctor, NULL, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; cl_limit = nmbclusters; - mclmeta_cache = objcache_create("cluster mbuf", &cl_limit, 0, + mclmeta_cache = objcache_create("cluster mbuf", + &cl_limit, 0, mclmeta_ctor, mclmeta_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mclmeta_malloc_args); cl_limit = nmbclusters; - mjclmeta_cache = objcache_create("jcluster mbuf", &cl_limit, 0, + mjclmeta_cache = objcache_create("jcluster mbuf", + &cl_limit, 0, mjclmeta_ctor, mclmeta_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mclmeta_malloc_args); limit = nmbclusters; - mbufcluster_cache = objcache_create("mbuf + cluster", &limit, 0, + mbufcluster_cache = objcache_create("mbuf + cluster", + &limit, 0, mbufcluster_ctor, mbufcluster_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; limit = nmbclusters; mbufphdrcluster_cache = objcache_create("mbuf pkt hdr + cluster", - &limit, 128, mbufphdrcluster_ctor, mbufcluster_dtor, NULL, + &limit, nmbclusters / 16, + mbufphdrcluster_ctor, mbufcluster_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; limit = nmbclusters; - mbufjcluster_cache = objcache_create("mbuf + jcluster", &limit, 0, + mbufjcluster_cache = objcache_create("mbuf + jcluster", + &limit, 0, mbufjcluster_ctor, mbufcluster_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; limit = nmbclusters; mbufphdrjcluster_cache = objcache_create("mbuf pkt hdr + jcluster", - &limit, 64, mbufphdrjcluster_ctor, mbufcluster_dtor, NULL, + &limit, nmbclusters / 16, + mbufphdrjcluster_ctor, mbufcluster_dtor, NULL, objcache_malloc_alloc, objcache_malloc_free, &mbuf_malloc_args); mb_limit += limit; -- 2.41.0