summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-07-19 14:39:35 -0700
committerBrian Behlendorf <[email protected]>2013-07-30 15:39:23 -0700
commitceb387282577b872264143515fc4f55043368b0f (patch)
treea86aca9e560b78c94bc26fab28537c293aa52ab0 /module
parentb9b3715346b2748b2e512099862f1eabf076cf51 (diff)
Fix KMC_OFFSLAB type caches
Because spl_slab_size() was always returning -ENOSPC for caches of type KMC_OFFSLAB the cache could never be created. Additionally the slab size is rounded up to a page which is what kv_alloc() expects. The kv_alloc() code will minimally allocate a page, in the KMC_OFFSLAB case this could be reduced. The basic regression tests kmem:slab_small, kmem:slab_large, and kmem:slab_align regression were updated to test KMC_OFFSLAB. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ying Zhu <[email protected]> Closes #266
Diffstat (limited to 'module')
-rw-r--r--module/spl/spl-kmem.c3
-rw-r--r--module/splat/splat-kmem.c45
2 files changed, 45 insertions, 3 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index 9e1b0db0f..3c01ab69c 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -1368,7 +1368,8 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size)
if (skc->skc_flags & KMC_OFFSLAB) {
*objs = SPL_KMEM_CACHE_OBJ_PER_SLAB;
- *size = sizeof(spl_kmem_slab_t);
+ *size = P2ROUNDUP(sizeof(spl_kmem_slab_t), PAGE_SIZE);
+ SRETURN(0);
} else {
sks_size = spl_sks_size(skc);
obj_size = spl_obj_size(skc);
diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c
index 0eab14217..c7f36caac 100644
--- a/module/splat/splat-kmem.c
+++ b/module/splat/splat-kmem.c
@@ -745,6 +745,7 @@ splat_kmem_test5(struct file *file, void *arg)
char *name = SPLAT_KMEM_TEST5_NAME;
int rc;
+ /* On slab (default + kmem + vmem) */
rc = splat_kmem_cache_test(file, arg, name, 128, 0, 0);
if (rc)
return rc;
@@ -753,7 +754,24 @@ splat_kmem_test5(struct file *file, void *arg)
if (rc)
return rc;
- return splat_kmem_cache_test(file, arg, name, 128, 0, KMC_VMEM);
+ rc = splat_kmem_cache_test(file, arg, name, 128, 0, KMC_VMEM);
+ if (rc)
+ return rc;
+
+ /* Off slab (default + kmem + vmem) */
+ rc = splat_kmem_cache_test(file, arg, name, 128, 0, KMC_OFFSLAB);
+ if (rc)
+ return rc;
+
+ rc = splat_kmem_cache_test(file, arg, name, 128, 0,
+ KMC_KMEM | KMC_OFFSLAB);
+ if (rc)
+ return rc;
+
+ rc = splat_kmem_cache_test(file, arg, name, 128, 0,
+ KMC_VMEM | KMC_OFFSLAB);
+
+ return rc;
}
/*
@@ -765,6 +783,7 @@ splat_kmem_test6(struct file *file, void *arg)
char *name = SPLAT_KMEM_TEST6_NAME;
int rc;
+ /* On slab (default + kmem + vmem) */
rc = splat_kmem_cache_test(file, arg, name, 256*1024, 0, 0);
if (rc)
return rc;
@@ -773,7 +792,24 @@ splat_kmem_test6(struct file *file, void *arg)
if (rc)
return rc;
- return splat_kmem_cache_test(file, arg, name, 1024*1024, 0, KMC_VMEM);
+ rc = splat_kmem_cache_test(file, arg, name, 1024*1024, 0, KMC_VMEM);
+ if (rc)
+ return rc;
+
+ /* Off slab (default + kmem + vmem) */
+ rc = splat_kmem_cache_test(file, arg, name, 256*1024, 0, KMC_OFFSLAB);
+ if (rc)
+ return rc;
+
+ rc = splat_kmem_cache_test(file, arg, name, 64*1024, 0,
+ KMC_KMEM | KMC_OFFSLAB);
+ if (rc)
+ return rc;
+
+ rc = splat_kmem_cache_test(file, arg, name, 1024*1024, 0,
+ KMC_VMEM | KMC_OFFSLAB);
+
+ return rc;
}
/*
@@ -789,6 +825,11 @@ splat_kmem_test7(struct file *file, void *arg)
rc = splat_kmem_cache_test(file, arg, name, 157, i, 0);
if (rc)
return rc;
+
+ rc = splat_kmem_cache_test(file, arg, name, 157, i,
+ KMC_OFFSLAB);
+ if (rc)
+ return rc;
}
return rc;