summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2012-01-24 23:32:09 +0000
committerRobert Mustacchi <rm@joyent.com>2012-01-24 23:46:41 +0000
commit045fa6fc0836f3def18745b617bd1878838eca03 (patch)
treed132c8719ab34d74fa4488bbb1dc73cd7f9ea9a4
parenta5846c012a9b349c81714227e526c73a177517ba (diff)
downloadillumos-joyent-045fa6fc0836f3def18745b617bd1878838eca03.tar.gz
OS-889 libumem should not use instant fit allocator by default
OS-890 libumem should support up to 128k slabs Reviewed by: Brendan Gregg <brendan.gregg@joyent.com>
-rw-r--r--usr/src/lib/libumem/common/umem.c32
-rw-r--r--usr/src/lib/libumem/common/umem_impl.h5
-rw-r--r--usr/src/lib/libumem/common/vmem_base.c2
3 files changed, 32 insertions, 7 deletions
diff --git a/usr/src/lib/libumem/common/umem.c b/usr/src/lib/libumem/common/umem.c
index a3eb0b8e6c..9ee030dd47 100644
--- a/usr/src/lib/libumem/common/umem.c
+++ b/usr/src/lib/libumem/common/umem.c
@@ -21,11 +21,10 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* based on usr/src/uts/common/os/kmem.c r1.64 from 2001/12/18
*
@@ -355,6 +354,17 @@
* umem_log_header_t's:
* lh_cpu[*].clh_lock
* lh_lock
+ *
+ * 7. Changing UMEM_MAXBUF
+ * -----------------------
+ *
+ * When changing UMEM_MAXBUF extra care has to be taken. It is not sufficient to
+ * simply increase this number. First, one must update the umem_alloc_table to
+ * have the appropriate number of entires based upon the new size. If this is
+ * not done, this will lead to libumem blowing an assertion.
+ *
+ * The second place to update, which is not required, is the umem_alloc_sizes.
+ * These determine the default cache sizes that we're going to support.
*/
#include <umem_impl.h>
@@ -420,7 +430,9 @@ static int umem_alloc_sizes[] = {
P2ALIGN(8192 / 2, 64), 4544,
P2ALIGN(8192 / 1, 64), 9216,
4096 * 3,
- UMEM_MAXBUF, /* = 8192 * 2 */
+ 8192 * 2, /* = 8192 * 2 */
+ 24576, 32768, 40960, 49152, 57344, 65536, 73728, 81920,
+ 90112, 98304, 106496, 114688, 122880, UMEM_MAXBUF, /* 128k */
/* 24 slots for user expansion */
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -592,6 +604,20 @@ umem_cache_t umem_null_cache = {
static umem_cache_t *umem_alloc_table[UMEM_MAXBUF >> UMEM_ALIGN_SHIFT] = {
ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
ALLOC_TABLE_1024
};
diff --git a/usr/src/lib/libumem/common/umem_impl.h b/usr/src/lib/libumem/common/umem_impl.h
index c6481d9751..84313c32ed 100644
--- a/usr/src/lib/libumem/common/umem_impl.h
+++ b/usr/src/lib/libumem/common/umem_impl.h
@@ -21,14 +21,13 @@
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _UMEM_IMPL_H
#define _UMEM_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <umem.h>
#include <sys/sysmacros.h>
@@ -353,7 +352,7 @@ typedef struct umem_cpu {
uint32_t cpu_number;
} umem_cpu_t;
-#define UMEM_MAXBUF 16384
+#define UMEM_MAXBUF 131072
#define UMEM_ALIGN 8 /* min guaranteed alignment */
#define UMEM_ALIGN_SHIFT 3 /* log2(UMEM_ALIGN) */
diff --git a/usr/src/lib/libumem/common/vmem_base.c b/usr/src/lib/libumem/common/vmem_base.c
index d64f6362d6..dcd83ddf31 100644
--- a/usr/src/lib/libumem/common/vmem_base.c
+++ b/usr/src/lib/libumem/common/vmem_base.c
@@ -29,7 +29,7 @@
#include "umem_base.h"
uint_t vmem_backend = 0;
-uint_t vmem_allocator = 0;
+uint_t vmem_allocator = VM_BESTFIT;
vmem_t *
vmem_heap_arena(vmem_alloc_t **allocp, vmem_free_t **freep)