/* * This test creates N threads with a shared kmem cache. They then all * concurrently allocate and free from the cache to stress the locking and * concurrent cache performance. If any one test takes longer than 5 * seconds to complete it is treated as a failure and may indicate a * performance regression. On my test system no one test takes more * than 1 second to complete so a 5x slowdown likely a problem. */ static int splat_kmem_test10(struct file *file, void *arg) { uint64_t size, alloc, rc = 0; for (size = 16; size <= 1024*1024; size *= 2) { splat_vprint(file, SPLAT_KMEM_TEST10_NAME, "%-22s %s", "name", "time (sec)\tslabs \tobjs \thash\n"); splat_vprint(file, SPLAT_KMEM_TEST10_NAME, "%-22s %s", "", " \ttot/max/calc\ttot/max/calc\n"); for (alloc = 1; alloc <= 1024; alloc *= 2) { /* Skip tests which exceed available memory. We * leverage availrmem here for some extra testing */ if (size * alloc * SPLAT_KMEM_THREADS > availrmem / 2) continue; rc = splat_kmem_cache_thread_test(file, arg, SPLAT_KMEM_TEST10_NAME, size, alloc, 5); if (rc) break; } } return rc; }
/* * This test creates N threads with a shared kmem cache. They then all * concurrently allocate and free from the cache to stress the locking and * concurrent cache performance. If any one test takes longer than 5 * seconds to complete it is treated as a failure and may indicate a * performance regression. On my test system no one test takes more * than 1 second to complete so a 5x slowdown likely a problem. */ static int splat_kmem_test10(struct file *file, void *arg) { uint64_t size, alloc, maxsize, limit, rc = 0; #if defined(CONFIG_64BIT) maxsize = (1024 * 1024); #else maxsize = (128 * 1024); #endif for (size = 32; size <= maxsize; size *= 2) { splat_vprint(file, SPLAT_KMEM_TEST10_NAME, "%-22s %s", "name", "time (sec)\tslabs \tobjs \thash\n"); splat_vprint(file, SPLAT_KMEM_TEST10_NAME, "%-22s %s", "", " \ttot/max/calc\ttot/max/calc\n"); for (alloc = 1; alloc <= 1024; alloc *= 2) { /* Skip tests which exceed 1/2 of memory. */ limit = MIN(physmem * PAGE_SIZE, vmem_size(NULL, VMEM_ALLOC | VMEM_FREE)) / 2; if (size * alloc * SPLAT_KMEM_THREADS > limit) continue; rc = splat_kmem_cache_thread_test(file, arg, SPLAT_KMEM_TEST10_NAME, size, alloc, 5); if (rc) break; } } return rc; }
/* * This test creates N threads with a shared kmem cache which overcommits * memory by 4x. This makes it impossible for the slab to satify the * thread requirements without having its reclaim hook run which will * free objects back for use. This behavior is triggered by the linum VM * detecting a low memory condition on the node and invoking the shrinkers. * This should allow all the threads to complete while avoiding deadlock * and for the most part out of memory events. This is very tough on the * system so it is possible the test app may get oom'ed. This particular * test has proven troublesome on 32-bit archs with limited virtual * address space so it only run on 64-bit systems. */ static int splat_kmem_test11(struct file *file, void *arg) { uint64_t size, alloc, rc; size = 256*1024; alloc = ((4 * physmem * PAGE_SIZE) / size) / SPLAT_KMEM_THREADS; splat_vprint(file, SPLAT_KMEM_TEST11_NAME, "%-22s %s", "name", "time (sec)\tslabs \tobjs \thash\n"); splat_vprint(file, SPLAT_KMEM_TEST11_NAME, "%-22s %s", "", " \ttot/max/calc\ttot/max/calc\n"); rc = splat_kmem_cache_thread_test(file, arg, SPLAT_KMEM_TEST11_NAME, size, alloc, 60); return rc; }