summaryrefslogtreecommitdiffstats
path: root/module/splat
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2015-11-16 14:45:42 -0800
committerBrian Behlendorf <[email protected]>2015-11-16 15:02:24 -0800
commite7b75d9b46fcfea149bf7fd1f53d40379e3c7b5d (patch)
treeba0e445e7f073be3467ff0f2cd396aae1ba48acc /module/splat
parent31f24932a4052c1802f56e44b8e5194f4e7910ab (diff)
Limit maximum object size in kmem tests
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 <[email protected]>
Diffstat (limited to 'module/splat')
-rw-r--r--module/splat/splat-kmem.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c
index b3fd1a84d..288112278 100644
--- a/module/splat/splat-kmem.c
+++ b/module/splat/splat-kmem.c
@@ -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