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;
73 fill_with_garbage(buf, size);
80 if (count_nonzero_bytes(buf, size))
82 fill_with_garbage(buf, size);
105 static int __init do_kmalloc_size(size_t size, int *total_failures)
109 buf = kmalloc(size, GFP_KERNEL);
112 fill_with_garbage(buf, size);
115 buf = kmalloc(size, GFP_KERNEL);
118 if (count_nonzero_bytes(buf, size))
120 fill_with_garbage(buf, size);
129 static int __init do_vmalloc_size(size_t size, int *total_failures)
133 buf = vmalloc(size);
136 fill_with_garbage(buf, size);
139 buf = vmalloc(size);
142 if (count_nonzero_bytes(buf, size))
144 fill_with_garbage(buf, size);
156 int i, size;
159 size = 1 << i;
160 num_tests += do_kmalloc_size(size, &failures);
161 num_tests += do_vmalloc_size(size, &failures);
187 static bool __init check_buf(void *buf, int size, bool want_ctor,
193 bytes = count_nonzero_bytes(buf, size);
216 static int __init do_kmem_cache_size(size_t size, bool want_ctor,
226 c = kmem_cache_create("test_cache", size, 1,
240 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero);
247 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero);
248 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0);
264 buf_copy = kmalloc(size, GFP_ATOMIC);
266 memcpy(buf_copy, buf, size);
274 fail |= check_buf(buf, size, want_ctor, want_rcu,
277 fail |= (bool)memcmp(buf, buf_copy, size);
292 static int __init do_kmem_cache_rcu_persistent(int size, int *total_failures)
300 c = kmem_cache_create("test_cache", size, size, SLAB_TYPESAFE_BY_RCU,
306 fill_with_garbage(buf, size);
307 buf_contents = kmalloc(size, GFP_KERNEL);
318 memcpy(buf_contents, buf, size);
328 fail = memcmp(buf_contents, buf, size);
347 static int __init do_kmem_cache_size_bulk(int size, int *total_failures)
355 c = kmem_cache_create("test_cache", size, size, 0, NULL);
360 bytes = count_nonzero_bytes(objects[i], size);
363 fill_with_garbage(objects[i], size);
381 int i, flags, size;
385 size = 8 << i;
392 num_tests += do_kmem_cache_size(size, ctor, rcu, zero,
395 num_tests += do_kmem_cache_size_bulk(size, &failures);
406 int i, size;
409 size = 8 << i;
410 num_tests += do_kmem_cache_rcu_persistent(size, &failures);