summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Chase <[email protected]>2015-04-14 01:06:40 -0400
committerBrian Behlendorf <[email protected]>2015-04-14 12:19:22 -0700
commit5074bfe8ade40ddc64cba5526eb1333a73621e92 (patch)
tree34a43dc45c9d1837df53eac01e552d75bab9828a
parentd07a16360c1ee219b8820f80d035e56a18c58b84 (diff)
Allocate zfs_znode_cache on the Linux slab
The Linux slab, in general, performs better than the SPl slab in cases where a lot of objects are allocated and fragmentation is likely present. This patch fixes pathologically bad behavior in cases where the ARC is filled with mostly metadata and a user program needs to allocate and dirty enough memory which would require an insignificant amount of the ARC to be reclaimed. If zfs_znode_cache is on the SPL slab, the system may spin for a very long time trying to reclaim sufficient memory. If it is on the Linux slab, the behavior has been observed to be much more predictible; the memory is reclaimed more efficiently. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #3283
-rw-r--r--module/zfs/zfs_znode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c
index c931a72c3..0c0091f04 100644
--- a/module/zfs/zfs_znode.c
+++ b/module/zfs/zfs_znode.c
@@ -147,12 +147,14 @@ void
zfs_znode_init(void)
{
/*
- * Initialize zcache
+ * Initialize zcache. The KMC_SLAB hint is used in order that it be
+ * backed by kmalloc() when on the Linux slab in order that any
+ * wait_on_bit() operations on the related inode operate properly.
*/
ASSERT(znode_cache == NULL);
znode_cache = kmem_cache_create("zfs_znode_cache",
sizeof (znode_t), 0, zfs_znode_cache_constructor,
- zfs_znode_cache_destructor, NULL, NULL, NULL, KMC_KMEM);
+ zfs_znode_cache_destructor, NULL, NULL, NULL, KMC_SLAB);
}
void