Lines Matching refs:size

29 static int __init count_nonzero_bytes(void *ptr, size_t size)
34 for (i = 0; i < size; i++)
41 static void __init fill_with_garbage_skip(void *ptr, int size, size_t skip)
46 WARN_ON(skip > size);
47 size -= skip;
49 while (size >= sizeof(*p)) {
52 size -= sizeof(*p);
54 if (size)
55 memset(&p[i], GARBAGE_BYTE, size);
58 static void __init fill_with_garbage(void *ptr, size_t size)
60 fill_with_garbage_skip(ptr, size, 0);
67 size_t size = PAGE_SIZE << order;
71 fill_with_garbage(buf, size);
76 if (count_nonzero_bytes(buf, size))
78 fill_with_garbage(buf, size);
98 static int __init do_kmalloc_size(size_t size, int *total_failures)
102 buf = kmalloc(size, GFP_KERNEL);
103 fill_with_garbage(buf, size);
106 buf = kmalloc(size, GFP_KERNEL);
107 if (count_nonzero_bytes(buf, size))
109 fill_with_garbage(buf, size);
115 static int __init do_vmalloc_size(size_t size, int *total_failures)
119 buf = vmalloc(size);
120 fill_with_garbage(buf, size);
123 buf = vmalloc(size);
124 if (count_nonzero_bytes(buf, size))
126 fill_with_garbage(buf, size);
135 int i, size;
138 size = 1 << i;
139 num_tests += do_kmalloc_size(size, &failures);
140 num_tests += do_vmalloc_size(size, &failures);
166 static bool __init check_buf(void *buf, int size, bool want_ctor,
172 bytes = count_nonzero_bytes(buf, size);
195 static int __init do_kmem_cache_size(size_t size, bool want_ctor,
205 c = kmem_cache_create("test_cache", size, 1,
219 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero);
226 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero);
227 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0);
243 buf_copy = kmalloc(size, GFP_ATOMIC);
245 memcpy(buf_copy, buf, size);
253 fail |= check_buf(buf, size, want_ctor, want_rcu,
256 fail |= (bool)memcmp(buf, buf_copy, size);
271 static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures)
279 c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU,
283 fill_with_garbage(buf, size);
284 buf_contents = kmalloc(size, GFP_KERNEL);
292 memcpy(buf_contents, buf, size);
302 fail = memcmp(buf_contents, buf, size);
318 static int __init do_kmem_cache_size_bulk(int size, int *total_failures)
326 c = kmem_cache_create("test_cache", size, size, 0, NULL);
331 bytes = count_nonzero_bytes(objects[i], size);
334 fill_with_garbage(objects[i], size);
352 int i, flags, size;
356 size = 8 << i;
363 num_tests += do_kmem_cache_size(size, ctor, rcu, zero,
366 num_tests += do_kmem_cache_size_bulk(size, &failures);
377 int i, size;
380 size = 8 << i;
381 num_tests += do_kmem_cache_rcu_persistent(size, &failures);