mm/slab_common: Improve error handling in kmem_cache_create
authorChristoph Lameter <cl@linux.com>
Wed, 5 Sep 2012 00:20:33 +0000 (00:20 +0000)
committerPekka Enberg <penberg@kernel.org>
Wed, 5 Sep 2012 09:00:35 +0000 (12:00 +0300)
commit686d550d222e8f83f6e709debbedf9d8ef77aec7
treeeb1a33c0a401c7fd9c22464a88c3c87fbfc8808d
parent208c4358dc4a8f0fe99e49eb8d21a869b01e7d34
mm/slab_common: Improve error handling in kmem_cache_create

Instead of using s == NULL use an errorcode. This allows much more
detailed diagnostics as to what went wrong. As we add more functionality
from the slab allocators to the common kmem_cache_create() function we will
also add more error conditions.

Print the error code during the panic as well as in a warning if the module
can handle failure. The API for kmem_cache_create() currently does not allow
the returning of an error code. Return NULL but log the cause of the problem
in the syslog.

Reviewed-by: Glauber Costa <glommer@parallels.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slab_common.c