]> git.proxmox.com Git - mirror_spl.git/commitdiff
Limit maximum object size in kmem tests
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 16 Nov 2015 22:45:42 +0000 (14:45 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 16 Nov 2015 23:02:24 +0000 (15:02 -0800)
Limit the maximum object size to 1/128 of total system memory for
the kmem cache tests.  Large values can result in out of memory errors
for systems with less the 512M of memory.  Additionally, use the
known number of objects per-slab for calculating the number of
objects to use for a test.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/splat/splat-kmem.c

index b3fd1a84dc871a4d95deaafcf9c88dfd6986860d..28811227816b5598bb5cf4ae51cd470b832dd88f 100644 (file)
@@ -590,6 +590,9 @@ splat_kmem_cache_test(struct file *file, void *arg, char *name,
        kmem_cache_data_t **kcd = NULL;
        int i, rc = 0, objs = 0;
 
+       /* Limit size for low memory machines (1/128 of memory) */
+       size = MIN(size, (physmem * PAGE_SIZE) >> 7);
+
        splat_vprint(file, name,
            "Testing size=%d, align=%d, flags=0x%04x\n",
            size, align, flags);
@@ -619,7 +622,7 @@ splat_kmem_cache_test(struct file *file, void *arg, char *name,
         * it to a single slab for the purposes of this test.
         */
 #ifdef _LP64
-       objs = SPL_KMEM_CACHE_OBJ_PER_SLAB * 4;
+       objs = kcp->kcp_cache->skc_slab_objs * 4;
 #else
        objs = 1;
 #endif