public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] slqb: remove unnecessary conditional in kmem_cache_create
@ 2009-09-30  4:42 David Rientjes
  2009-10-04 11:51 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: David Rientjes @ 2009-09-30  4:42 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Nick Piggin, linux-kernel

kmem_cache_open() panics when a SLAB_PANIC cache cannot be opened because
it has early callers using the flag that do not go through
kmem_cache_create().

If kmem_cache_open() fails for a SLAB_PANIC cache, it would have panicked
the machine.  Thus, checking for this flag in kmem_cache_create() is
unnecessary in the error patch since it is always clear.

Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/slqb.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/mm/slqb.c b/mm/slqb.c
--- a/mm/slqb.c
+++ b/mm/slqb.c
@@ -3077,9 +3077,6 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
 
 err:
 	up_write(&slqb_lock);
-	if (flags & SLAB_PANIC)
-		panic("%s: failed to create slab `%s'\n", __func__, name);
-
 	return NULL;
 }
 EXPORT_SYMBOL(kmem_cache_create);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] slqb: remove unnecessary conditional in kmem_cache_create
  2009-09-30  4:42 [patch] slqb: remove unnecessary conditional in kmem_cache_create David Rientjes
@ 2009-10-04 11:51 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2009-10-04 11:51 UTC (permalink / raw)
  To: David Rientjes; +Cc: Nick Piggin, linux-kernel

David Rientjes wrote:
> kmem_cache_open() panics when a SLAB_PANIC cache cannot be opened because
> it has early callers using the flag that do not go through
> kmem_cache_create().
> 
> If kmem_cache_open() fails for a SLAB_PANIC cache, it would have panicked
> the machine.  Thus, checking for this flag in kmem_cache_create() is
> unnecessary in the error patch since it is always clear.

Yes, but there are other error cases in kmem_cache_create() that "goto 
err" for which we do need to check for SLAB_PANIC.

> 
> Cc: Nick Piggin <npiggin@suse.de>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  mm/slqb.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/slqb.c b/mm/slqb.c
> --- a/mm/slqb.c
> +++ b/mm/slqb.c
> @@ -3077,9 +3077,6 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
>  
>  err:
>  	up_write(&slqb_lock);
> -	if (flags & SLAB_PANIC)
> -		panic("%s: failed to create slab `%s'\n", __func__, name);
> -
>  	return NULL;
>  }
>  EXPORT_SYMBOL(kmem_cache_create);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-04 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30  4:42 [patch] slqb: remove unnecessary conditional in kmem_cache_create David Rientjes
2009-10-04 11:51 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox