Lines Matching full: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()
192 static int __init do_kmem_cache_size(size_t size, bool want_ctor, in do_kmem_cache_size() argument
202 c = kmem_cache_create("test_cache", size, 1, in do_kmem_cache_size()
208 fail = check_buf(buf, size, want_ctor, want_rcu, want_zero); in do_kmem_cache_size()
209 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0); in do_kmem_cache_size()
225 buf_copy = kmalloc(size, GFP_ATOMIC); in do_kmem_cache_size()
227 memcpy(buf_copy, buf, size); in do_kmem_cache_size()
235 fail |= check_buf(buf, size, want_ctor, want_rcu, in do_kmem_cache_size()
238 fail |= (bool)memcmp(buf, buf_copy, size); in do_kmem_cache_size()
253 static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures) in do_kmem_cache_rcu_persistent() argument
261 c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU, in do_kmem_cache_rcu_persistent()
265 fill_with_garbage(buf, size); in do_kmem_cache_rcu_persistent()
266 buf_contents = kmalloc(size, GFP_KERNEL); in do_kmem_cache_rcu_persistent()
274 memcpy(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
284 fail = memcmp(buf_contents, buf, size); in do_kmem_cache_rcu_persistent()
300 static int __init do_kmem_cache_size_bulk(int size, int *total_failures) in do_kmem_cache_size_bulk() argument
308 c = kmem_cache_create("test_cache", size, size, 0, NULL); in do_kmem_cache_size_bulk()
313 bytes = count_nonzero_bytes(objects[i], size); in do_kmem_cache_size_bulk()
316 fill_with_garbage(objects[i], size); in do_kmem_cache_size_bulk()
333 int i, flags, size; in test_kmemcache() local
337 size = 8 << i; in test_kmemcache()
344 num_tests += do_kmem_cache_size(size, ctor, rcu, zero, in test_kmemcache()
347 num_tests += do_kmem_cache_size_bulk(size, &failures); in test_kmemcache()
358 int i, size; in test_rcu_persistent() local
361 size = 8 << i; in test_rcu_persistent()
362 num_tests += do_kmem_cache_rcu_persistent(size, &failures); in test_rcu_persistent()