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
71 fill_with_garbage(buf, size); in do_alloc_pages_order()
76 if (count_nonzero_bytes(buf, size)) in do_alloc_pages_order()
78 fill_with_garbage(buf, size); in do_alloc_pages_order()
98 static int __init do_kmalloc_size(size_t size, int *total_failures) in do_kmalloc_size() argument
102 buf = kmalloc(size, GFP_KERNEL); in do_kmalloc_size()
103 fill_with_garbage(buf, size); in do_kmalloc_size()
106 buf = kmalloc(size, GFP_KERNEL); in do_kmalloc_size()
107 if (count_nonzero_bytes(buf, size)) in do_kmalloc_size()
109 fill_with_garbage(buf, size); in do_kmalloc_size()
115 static int __init do_vmalloc_size(size_t size, int *total_failures) in do_vmalloc_size() argument
119 buf = vmalloc(size); in do_vmalloc_size()
120 fill_with_garbage(buf, size); in do_vmalloc_size()
123 buf = vmalloc(size); in do_vmalloc_size()
124 if (count_nonzero_bytes(buf, size)) in do_vmalloc_size()
126 fill_with_garbage(buf, size); in do_vmalloc_size()
135 int i, size; in test_kvmalloc() local
138 size = 1 << i; in test_kvmalloc()
139 num_tests += do_kmalloc_size(size, &failures); in test_kvmalloc()
140 num_tests += do_vmalloc_size(size, &failures); in test_kvmalloc()
166 static bool __init check_buf(void *buf, int size, bool want_ctor, in check_buf() argument
172 bytes = count_nonzero_bytes(buf, size); in check_buf()
195 static int __init do_kmem_cache_size(size_t size, bool want_ctor, in do_kmem_cache_size() argument
205 c = kmem_cache_create("test_cache", size, 1, in do_kmem_cache_size()
219 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero); in do_kmem_cache_size()
226 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero); in do_kmem_cache_size()
227 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0); in do_kmem_cache_size()
243 buf_copy = kmalloc(size, GFP_ATOMIC); in do_kmem_cache_size()
245 memcpy(buf_copy, buf, size); in do_kmem_cache_size()
253 fail |= check_buf(buf, size, want_ctor, want_rcu, in do_kmem_cache_size()
256 fail |= (bool)memcmp(buf, buf_copy, size); in do_kmem_cache_size()
271 static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures) in do_kmem_cache_rcu_persistent() argument
279 c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU, in do_kmem_cache_rcu_persistent()
285 fill_with_garbage(buf, size); in do_kmem_cache_rcu_persistent()
286 buf_contents = kmalloc(size, GFP_KERNEL); in do_kmem_cache_rcu_persistent()
297 memcpy(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
307 fail = memcmp(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
326 static int __init do_kmem_cache_size_bulk(int size, int *total_failures) in do_kmem_cache_size_bulk() argument
334 c = kmem_cache_create("test_cache", size, size, 0, NULL); in do_kmem_cache_size_bulk()
339 bytes = count_nonzero_bytes(objects[i], size); in do_kmem_cache_size_bulk()
342 fill_with_garbage(objects[i], size); in do_kmem_cache_size_bulk()
360 int i, flags, size; in test_kmemcache() local
364 size = 8 << i; in test_kmemcache()
371 num_tests += do_kmem_cache_size(size, ctor, rcu, zero, in test_kmemcache()
374 num_tests += do_kmem_cache_size_bulk(size, &failures); in test_kmemcache()
385 int i, size; in test_rcu_persistent() local
388 size = 8 << i; in test_rcu_persistent()
389 num_tests += do_kmem_cache_rcu_persistent(size, &failures); in test_rcu_persistent()