Lines Matching refs:size
29 static int __init count_nonzero_bytes(void *ptr, size_t size) in count_nonzero_bytes() argument
34 for (i = 0; i < size; i++) in count_nonzero_bytes()
41 static void __init fill_with_garbage_skip(void *ptr, int size, size_t skip) in fill_with_garbage_skip() argument
46 WARN_ON(skip > size); in fill_with_garbage_skip()
47 size -= skip; in fill_with_garbage_skip()
49 while (size >= sizeof(*p)) { in fill_with_garbage_skip()
52 size -= sizeof(*p); in fill_with_garbage_skip()
54 if (size) in fill_with_garbage_skip()
55 memset(&p[i], GARBAGE_BYTE, size); in fill_with_garbage_skip()
58 static void __init fill_with_garbage(void *ptr, size_t size) in fill_with_garbage() argument
60 fill_with_garbage_skip(ptr, size, 0); in fill_with_garbage()
67 size_t size = PAGE_SIZE << order; in do_alloc_pages_order() local
73 fill_with_garbage(buf, size); in do_alloc_pages_order()
80 if (count_nonzero_bytes(buf, size)) in do_alloc_pages_order()
82 fill_with_garbage(buf, size); in do_alloc_pages_order()
105 static int __init do_kmalloc_size(size_t size, int *total_failures) in do_kmalloc_size() argument
109 buf = kmalloc(size, GFP_KERNEL); in do_kmalloc_size()
112 fill_with_garbage(buf, size); in do_kmalloc_size()
115 buf = kmalloc(size, GFP_KERNEL); in do_kmalloc_size()
118 if (count_nonzero_bytes(buf, size)) in do_kmalloc_size()
120 fill_with_garbage(buf, size); in do_kmalloc_size()
129 static int __init do_vmalloc_size(size_t size, int *total_failures) in do_vmalloc_size() argument
133 buf = vmalloc(size); in do_vmalloc_size()
136 fill_with_garbage(buf, size); in do_vmalloc_size()
139 buf = vmalloc(size); in do_vmalloc_size()
142 if (count_nonzero_bytes(buf, size)) in do_vmalloc_size()
144 fill_with_garbage(buf, size); in do_vmalloc_size()
156 int i, size; in test_kvmalloc() local
159 size = 1 << i; in test_kvmalloc()
160 num_tests += do_kmalloc_size(size, &failures); in test_kvmalloc()
161 num_tests += do_vmalloc_size(size, &failures); in test_kvmalloc()
187 static bool __init check_buf(void *buf, int size, bool want_ctor, in check_buf() argument
193 bytes = count_nonzero_bytes(buf, size); in check_buf()
216 static int __init do_kmem_cache_size(size_t size, bool want_ctor, in do_kmem_cache_size() argument
226 c = kmem_cache_create("test_cache", size, 1, in do_kmem_cache_size()
240 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero); in do_kmem_cache_size()
247 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero); in do_kmem_cache_size()
248 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0); in do_kmem_cache_size()
264 buf_copy = kmalloc(size, GFP_ATOMIC); in do_kmem_cache_size()
266 memcpy(buf_copy, buf, size); in do_kmem_cache_size()
274 fail |= check_buf(buf, size, want_ctor, want_rcu, in do_kmem_cache_size()
277 fail |= (bool)memcmp(buf, buf_copy, size); in do_kmem_cache_size()
292 static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures) in do_kmem_cache_rcu_persistent() argument
300 c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU, in do_kmem_cache_rcu_persistent()
306 fill_with_garbage(buf, size); in do_kmem_cache_rcu_persistent()
307 buf_contents = kmalloc(size, GFP_KERNEL); in do_kmem_cache_rcu_persistent()
318 memcpy(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
328 fail = memcmp(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
347 static int __init do_kmem_cache_size_bulk(int size, int *total_failures) in do_kmem_cache_size_bulk() argument
355 c = kmem_cache_create("test_cache", size, size, 0, NULL); in do_kmem_cache_size_bulk()
360 bytes = count_nonzero_bytes(objects[i], size); in do_kmem_cache_size_bulk()
363 fill_with_garbage(objects[i], size); in do_kmem_cache_size_bulk()
381 int i, flags, size; in test_kmemcache() local
385 size = 8 << i; in test_kmemcache()
392 num_tests += do_kmem_cache_size(size, ctor, rcu, zero, in test_kmemcache()
395 num_tests += do_kmem_cache_size_bulk(size, &failures); in test_kmemcache()
406 int i, size; in test_rcu_persistent() local
409 size = 8 << i; in test_rcu_persistent()
410 num_tests += do_kmem_cache_rcu_persistent(size, &failures); in test_rcu_persistent()