Some simply thrown in thing that allocates 100 objects and frees them again.
Spews out complaints about interrupts disabled since we are in an initcall.
But it shows that it works.
Signed-off-by: Christoph Lameter <[email protected]>
Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c
+++ linux/mm/slub.c
@@ -5308,6 +5308,22 @@ static int __init slab_sysfs_init(void)
mutex_unlock(&slab_mutex);
resiliency_test();
+
+ /* Test array alloc */
+ {
+ void *arr[100];
+ int nr;
+
+ printk(KERN_INFO "Array allocation test\n");
+ printk(KERN_INFO "---------------------\n");
+ printk(KERN_INFO "Allocation 100 objects\n");
+ nr = kmem_cache_alloc_array(kmem_cache_node, GFP_KERNEL, 100, arr);
+ printk(KERN_INFO "Number allocated = %d\n", nr);
+ printk(KERN_INFO "Freeing the objects\n");
+ kmem_cache_free_array(kmem_cache_node, 100, arr);
+ printk(KERN_INFO "Array allocation test done.\n");
+ }
+
return 0;
}