From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030446Ab2HIOUx (ORCPT ); Thu, 9 Aug 2012 10:20:53 -0400 Received: from nlpi157.sbcis.sbc.com ([207.115.36.171]:34856 "EHLO nlpi157.prodigy.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030188Ab2HIOUu (ORCPT ); Thu, 9 Aug 2012 10:20:50 -0400 Date: Thu, 9 Aug 2012 09:13:06 -0500 (CDT) From: "Christoph Lameter (Open Source)" X-X-Sender: cl@greybox.home 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 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> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.