diff options
Diffstat (limited to 'lib/test_meminit.c')
-rw-r--r-- | lib/test_meminit.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/test_meminit.c b/lib/test_meminit.c index 9729f271d150..9742e5cb853a 100644 --- a/lib/test_meminit.c +++ b/lib/test_meminit.c | |||
@@ -297,6 +297,32 @@ out: | |||
297 | return 1; | 297 | return 1; |
298 | } | 298 | } |
299 | 299 | ||
300 | static int __init do_kmem_cache_size_bulk(int size, int *total_failures) | ||
301 | { | ||
302 | struct kmem_cache *c; | ||
303 | int i, iter, maxiter = 1024; | ||
304 | int num, bytes; | ||
305 | bool fail = false; | ||
306 | void *objects[10]; | ||
307 | |||
308 | c = kmem_cache_create("test_cache", size, size, 0, NULL); | ||
309 | for (iter = 0; (iter < maxiter) && !fail; iter++) { | ||
310 | num = kmem_cache_alloc_bulk(c, GFP_KERNEL, ARRAY_SIZE(objects), | ||
311 | objects); | ||
312 | for (i = 0; i < num; i++) { | ||
313 | bytes = count_nonzero_bytes(objects[i], size); | ||
314 | if (bytes) | ||
315 | fail = true; | ||
316 | fill_with_garbage(objects[i], size); | ||
317 | } | ||
318 | |||
319 | if (num) | ||
320 | kmem_cache_free_bulk(c, num, objects); | ||
321 | } | ||
322 | *total_failures += fail; | ||
323 | return 1; | ||
324 | } | ||
325 | |||
300 | /* | 326 | /* |
301 | * Test kmem_cache allocation by creating caches of different sizes, with and | 327 | * Test kmem_cache allocation by creating caches of different sizes, with and |
302 | * without constructors, with and without SLAB_TYPESAFE_BY_RCU. | 328 | * without constructors, with and without SLAB_TYPESAFE_BY_RCU. |
@@ -318,6 +344,7 @@ static int __init test_kmemcache(int *total_failures) | |||
318 | num_tests += do_kmem_cache_size(size, ctor, rcu, zero, | 344 | num_tests += do_kmem_cache_size(size, ctor, rcu, zero, |
319 | &failures); | 345 | &failures); |
320 | } | 346 | } |
347 | num_tests += do_kmem_cache_size_bulk(size, &failures); | ||
321 | } | 348 | } |
322 | REPORT_FAILURES_IN_FN(); | 349 | REPORT_FAILURES_IN_FN(); |
323 | *total_failures += failures; | 350 | *total_failures += failures; |