From 97f274d46d8eb330f806cd445cfd186446aeb1de Mon Sep 17 00:00:00 2001 From: behlendo Date: Mon, 7 Jul 2008 22:15:04 +0000 Subject: [PATCH] Fix race in kmem_locking test Reduce max memory usage for kmem_locking tests (for low memory machines) git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@145 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c --- modules/splat/splat-kmem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/splat/splat-kmem.c b/modules/splat/splat-kmem.c index af28c71..27e27a5 100644 --- a/modules/splat/splat-kmem.c +++ b/modules/splat/splat-kmem.c @@ -572,10 +572,10 @@ splat_kmem_test8_count(kmem_cache_priv_t *kcp, int threads) int ret; spin_lock(&kcp->kcp_lock); - ret = (kcp->kcp_threads == threads); - spin_unlock(&kcp->kcp_lock); + ret = (kcp->kcp_threads == threads); + spin_unlock(&kcp->kcp_lock); - return ret; + return ret; } /* This test will always pass and is simply here so I can easily @@ -625,7 +625,9 @@ splat_kmem_test8_sc(struct file *file, void *arg, int size, int count) thr = thread_create(NULL, 0, splat_kmem_test8_thread, &kcp, 0, &p0, TS_RUN, minclsyspri); ASSERT(thr != NULL); + spin_lock(&kcp.kcp_lock); kcp.kcp_threads++; + spin_unlock(&kcp.kcp_lock); } /* Sleep until the thread sets kcp.kcp_threads == 0 */ @@ -662,7 +664,7 @@ splat_kmem_test8(struct file *file, void *arg) /* Run through slab cache with objects size from * 16-1Mb in 4x multiples with 1024 objects each */ for (i = 16; i <= 1024*1024; i *= 4) { - rc = splat_kmem_test8_sc(file, arg, i, 1024); + rc = splat_kmem_test8_sc(file, arg, i, 256); if (rc) break; } -- 2.40.0