From: Glauber Costa <glommer@parallels.com>
To: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>,
linux-mm@kvack.org, David Rientjes <rientjes@google.com>,
Matt Mackall <mpm@selenic.com>, Joonsoo Kim <js1304@gmail.com>
Subject: Re: Common [08/20] Extract common code for kmem_cache_create()
Date: Thu, 14 Jun 2012 18:20:55 +0400 [thread overview]
Message-ID: <4FD9F347.2020409@parallels.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1206140912250.32075@router.home>
On 06/14/2012 06:18 PM, Christoph Lameter wrote:
> On Thu, 14 Jun 2012, Glauber Costa wrote:
>
>> On 06/13/2012 07:24 PM, Christoph Lameter wrote:
>>> +struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t
>>> align,
>>> + unsigned long flags, void (*ctor)(void *))
>>> +{
>>> + 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);
>>> + goto out;
>>> + }
>>> +#endif
>>
>> Not really a BUG, but label out is not used if !CONFIG_DEBUG_VM. Suggest
>> testing for the slab panic flag here, and panicing if we need to.
>
> Hmmm.. That is quite sensitive. A change here will cause later patches in
> the series to have issues. Maybe its best to put an #ifdef around the
> label until a later patch that makes use of out: from code that is not
> #ifdefed.
>
>
> Subject: Add #ifdef to avoid warning about unused label
>
> out: is only used if CONFIG_DEBUG_VM is enabled.
>
> Signed-off-by: Christoph Lameter<cl@linux.com>
>
> Index: linux-2.6/mm/slab_common.c
> ===================================================================
> --- linux-2.6.orig/mm/slab_common.c 2012-06-14 03:16:06.778702087 -0500
> +++ linux-2.6/mm/slab_common.c 2012-06-14 03:16:01.054702201 -0500
> @@ -57,7 +57,9 @@ struct kmem_cache *kmem_cache_create(con
>
> s = __kmem_cache_create(name, size, align, flags, ctor);
>
> +#ifdef CONFIG_DEBUG_VM
> out:
> +#endif
> if (!s&& (flags& SLAB_PANIC))
> panic("kmem_cache_create: Failed to create slab '%s'\n", name);
>
That's how my code reads:
#ifdef CONFIG_DEBUG_VM
if (!name || in_interrupt() || size < sizeof(void *) ||
size KMALLOC_MAX_SIZE) {
if ((flags & SLAB_PANIC))
panic("kmem_cache_create(%s) integrity check failed\n", name);
printk(KERN_ERR "kmem_cache_create(%s) integrity check failed\n",
name);
return NULL;
}
#endif
How can it put any patch later than this in trouble ?
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-06-14 14:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 15:24 Common [00/20] Sl[auo]b: Common code rework V5 (for merge) Christoph Lameter
2012-06-13 15:24 ` Common [01/20] [slob] Define page struct fields used in mm_types.h Christoph Lameter
2012-06-13 15:24 ` Common [03/20] [slob] Remove various small accessors Christoph Lameter
2012-06-13 15:24 ` Common [04/20] [slab] Use page struct fields instead of casting Christoph Lameter
2012-06-13 15:24 ` Common [05/20] [slab] Remove some accessors Christoph Lameter
2012-06-13 15:24 ` Common [06/20] Extract common fields from struct kmem_cache Christoph Lameter
2012-06-13 15:24 ` Common [07/20] [slab] Get rid of obj_size macro Christoph Lameter
2012-06-13 15:24 ` Common [08/20] Extract common code for kmem_cache_create() Christoph Lameter
2012-06-14 8:15 ` Glauber Costa
2012-06-14 14:18 ` Christoph Lameter
2012-06-14 14:20 ` Glauber Costa [this message]
2012-06-14 14:46 ` Christoph Lameter
2012-06-13 15:25 ` Common [09/20] Common definition for boot state of the slab allocators Christoph Lameter
2012-06-13 15:25 ` Common [10/20] Use a common mutex definition Christoph Lameter
2012-06-13 15:25 ` Common [11/20] Move kmem_cache_create mutex handling to common code Christoph Lameter
2012-06-13 15:25 ` Common [13/20] Extract a common function for kmem_cache_destroy Christoph Lameter
2012-06-13 15:25 ` Common [14/20] Always use the name "kmem_cache" for the slab cache with the kmem_cache structure Christoph Lameter
2012-06-14 8:16 ` Glauber Costa
2012-06-14 14:12 ` Christoph Lameter
2012-06-13 15:25 ` Common [16/20] Get rid of __kmem_cache_destroy Christoph Lameter
2012-06-13 15:25 ` Common [17/20] Move duping of slab name to slab_common.c Christoph Lameter
2012-06-14 8:19 ` Glauber Costa
2012-06-13 15:25 ` Common [18/20] Do slab aliasing call from common code Christoph Lameter
2012-06-13 15:25 ` Common [19/20] Allocate kmem_cache structure in slab_common.c Christoph Lameter
2012-06-14 10:16 ` Pekka Enberg
2012-06-14 10:34 ` Glauber Costa
2012-06-14 18:14 ` Christoph Lameter
2012-06-20 7:07 ` Pekka Enberg
2012-06-13 15:25 ` Common [20/20] Common alignment code Christoph Lameter
2012-06-14 8:14 ` Common [00/20] Sl[auo]b: Common code rework V5 (for merge) Glauber Costa
2012-06-14 14:03 ` Christoph Lameter
-- strict thread matches above, loose matches on Subject: below --
2012-06-01 19:52 Common [00/20] Sl[auo]b: Common code rework V4 Christoph Lameter
2012-06-01 19:52 ` Common [08/20] Extract common code for kmem_cache_create() Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD9F347.2020409@parallels.com \
--to=glommer@parallels.com \
--cc=cl@linux.com \
--cc=js1304@gmail.com \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.