6863750 kmem metadata in zfs_file_data impedes debugging non-debug crash dumps
6942439 Sporadic complete I/O halts
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h Wed Aug 18 15:20:51 2010 -0400
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h Wed Aug 18 12:47:36 2010 -0700
@@ -315,6 +315,7 @@
#define KM_PUSHPAGE KM_SLEEP
#define KM_NOSLEEP UMEM_DEFAULT
#define KMC_NODEBUG UMC_NODEBUG
+#define KMC_NOTOUCH 0 /* not needed for userland caches */
#define kmem_alloc(_s, _f) umem_alloc(_s, _f)
#define kmem_zalloc(_s, _f) umem_zalloc(_s, _f)
#define kmem_free(_b, _s) umem_free(_b, _s)
--- a/usr/src/uts/common/fs/zfs/zio.c Wed Aug 18 15:20:51 2010 -0400
+++ b/usr/src/uts/common/fs/zfs/zio.c Wed Aug 18 12:47:36 2010 -0700
@@ -117,6 +117,7 @@
size_t size = (c + 1) << SPA_MINBLOCKSHIFT;
size_t p2 = size;
size_t align = 0;
+ size_t cflags = (size > zio_buf_debug_limit) ? KMC_NODEBUG : 0;
while (p2 & (p2 - 1))
p2 &= p2 - 1;
@@ -133,13 +134,17 @@
char name[36];
(void) sprintf(name, "zio_buf_%lu", (ulong_t)size);
zio_buf_cache[c] = kmem_cache_create(name, size,
- align, NULL, NULL, NULL, NULL, NULL,
- size > zio_buf_debug_limit ? KMC_NODEBUG : 0);
-
+ align, NULL, NULL, NULL, NULL, NULL, cflags);
+
+ /*
+ * Since zio_data bufs do not appear in crash dumps, we
+ * pass KMC_NOTOUCH so that no allocator metadata is
+ * stored with the buffers.
+ */
(void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size);
zio_data_buf_cache[c] = kmem_cache_create(name, size,
align, NULL, NULL, NULL, NULL, data_alloc_arena,
- size > zio_buf_debug_limit ? KMC_NODEBUG : 0);
+ cflags | KMC_NOTOUCH);
}
}
--- a/usr/src/uts/common/vm/seg_kmem.c Wed Aug 18 15:20:51 2010 -0400
+++ b/usr/src/uts/common/vm/seg_kmem.c Wed Aug 18 12:47:36 2010 -0700
@@ -1519,8 +1519,13 @@
ASSERT(zio_mem_base != NULL);
ASSERT(zio_mem_size != 0);
+ /*
+ * To reduce VA space fragmentation, we set up quantum caches for the
+ * smaller sizes; we chose 32k because that translates to 128k VA
+ * slabs, which matches nicely with the common 128k zio_data bufs.
+ */
zio_arena = vmem_create("zfs_file_data", zio_mem_base, zio_mem_size,
- PAGESIZE, NULL, NULL, NULL, 0, VM_SLEEP);
+ PAGESIZE, NULL, NULL, NULL, 32 * 1024, VM_SLEEP);
zio_alloc_arena = vmem_create("zfs_file_data_buf", NULL, 0, PAGESIZE,
segkmem_zio_alloc, segkmem_zio_free, zio_arena, 0, VM_SLEEP);