From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx110.postini.com [74.125.245.110]) by kanga.kvack.org (Postfix) with SMTP id 065516B0062 for ; Thu, 9 Aug 2012 10:20:47 -0400 (EDT) Date: Thu, 9 Aug 2012 09:13:06 -0500 (CDT) From: "Christoph Lameter (Open Source)" Subject: Re: [PATCH v2] mm: Restructure kmem_cache_create() to move debug cache integrity checks into a new function In-Reply-To: <1344287631.2486.57.camel@lorien2> Message-ID: References: <1342221125.17464.8.camel@lorien2> <1344224494.3053.5.camel@lorien2> <1344266096.2486.17.camel@lorien2> <1344272614.2486.40.camel@lorien2> <1344287631.2486.57.camel@lorien2> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Shuah Khan Cc: penberg@kernel.org, glommer@parallels.com, js1304@gmail.com, David Rientjes , linux-mm@kvack.org, LKML , Andrew Morton , Linus Torvalds , shuahkhan@gmail.com On Mon, 6 Aug 2012, Shuah Khan wrote: > +#ifdef CONFIG_DEBUG_VM > +static int kmem_cache_sanity_check(const char *name, size_t size) Why do we pass "size" in? AFAICT there is no need to. > @@ -53,48 +93,17 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align > { > struct kmem_cache *s = NULL; > > -#ifdef CONFIG_DEBUG_VM > if (!name || in_interrupt() || size < sizeof(void *) || > size > KMALLOC_MAX_SIZE) { > - printk(KERN_ERR "kmem_cache_create(%s) integrity check" > - " failed\n", name); > + pr_err("kmem_cache_create(%s) integrity check failed\n", name); > goto out; > } > -#endif > If you move the above code into the sanity check function then you will be using the size as well. These are also sanity checks after all. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org