diff options
author | David S. Miller <davem@davemloft.net> | 2019-10-20 07:51:25 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-20 19:43:00 +0200 |
commit | 2f184393e0c2d409c62262f57f2a57efdf9370b8 (patch) | |
tree | 25b96db2550014d7f888605abfabb67a7f40a5d3 /lib/test_meminit.c | |
parent | Merge branch 'lpc_eth-parse-phy-nodes-from-device-tree' (diff) | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff) | |
download | linux-2f184393e0c2d409c62262f57f2a57efdf9370b8.tar.xz linux-2f184393e0c2d409c62262f57f2a57efdf9370b8.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Several cases of overlapping changes which were for the most
part trivially resolvable.
Signed-off-by: David S. Miller <davem@davemloft.net>
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: return 1; } +static int __init do_kmem_cache_size_bulk(int size, int *total_failures) +{ + struct kmem_cache *c; + int i, iter, maxiter = 1024; + int num, bytes; + bool fail = false; + void *objects[10]; + + c = kmem_cache_create("test_cache", size, size, 0, NULL); + for (iter = 0; (iter < maxiter) && !fail; iter++) { + num = kmem_cache_alloc_bulk(c, GFP_KERNEL, ARRAY_SIZE(objects), + objects); + for (i = 0; i < num; i++) { + bytes = count_nonzero_bytes(objects[i], size); + if (bytes) + fail = true; + fill_with_garbage(objects[i], size); + } + + if (num) + kmem_cache_free_bulk(c, num, objects); + } + *total_failures += fail; + return 1; +} + /* * Test kmem_cache allocation by creating caches of different sizes, with and * without constructors, with and without SLAB_TYPESAFE_BY_RCU. @@ -318,6 +344,7 @@ static int __init test_kmemcache(int *total_failures) num_tests += do_kmem_cache_size(size, ctor, rcu, zero, &failures); } + num_tests += do_kmem_cache_size_bulk(size, &failures); } REPORT_FAILURES_IN_FN(); *total_failures += failures; |