From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754061AbbBJTsQ (ORCPT ); Tue, 10 Feb 2015 14:48:16 -0500 Received: from resqmta-ch2-11v.sys.comcast.net ([69.252.207.43]:59818 "EHLO resqmta-ch2-11v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753973AbbBJTsP (ORCPT ); Tue, 10 Feb 2015 14:48:15 -0500 Message-Id: <20150210194812.009097005@linux.com> Date: Tue, 10 Feb 2015 13:48:07 -0600 From: Christoph Lameter To: akpm@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, penberg@kernel.org, iamjoonsoo@lge.com, Jesper Dangaard Brouer Subject: [PATCH 3/3] Array alloc test code References: <20150210194804.288708936@linux.com> Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=array_alloc_test Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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; }