From: Johannes Weiner <hannes-kernel@saeurebad.de>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, christoph@lameter.com,
penberg@cs.helsinki.fi
Subject: [PATCH] Catch kmalloc() failure in kmem_cache_init()
Date: Mon, 2 Apr 2007 12:18:13 +0200 [thread overview]
Message-ID: <20070402101813.GB5831@saeurebad.de> (raw)
In-Reply-To: <20070329160434.GA10265@cvg>
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
Hi,
This patch makes kmem_cache_init() trigger a BUG when the calls to
kmalloc() fail. Altough the kernel would not boot anyway on failure,
this adds some clarity to the code.
Signed-off-by: Johannes Weiner <hannes-kernel@saeurebad.de>
[-- Attachment #2: slab-cache-init-kmalloc-failure-catch.patch --]
[-- Type: text/plain, Size: 598 bytes --]
diff --git a/mm/slab.c b/mm/slab.c
index 57f7aa4..6d7e486 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1512,6 +1512,7 @@ void __init kmem_cache_init(void)
struct array_cache *ptr;
ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
+ BUG_ON(!ptr);
local_irq_disable();
BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
@@ -1526,6 +1527,7 @@ void __init kmem_cache_init(void)
local_irq_enable();
ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
+ BUG_ON(!ptr);
local_irq_disable();
BUG_ON(cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep)
next prev parent reply other threads:[~2007-04-02 10:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-29 16:04 [QUESTION] check for mem in slab Cyrill Gorcunov
2007-03-30 6:56 ` Heiko Carstens
2007-03-30 11:55 ` Pekka Enberg
2007-03-30 16:41 ` Cyrill Gorcunov
2007-04-02 9:50 ` [PATCH] Catch kmalloc failure in kmem_cache_init() (was: [QUESTION] check for mem in slab) Johannes Weiner
2007-04-02 10:18 ` Johannes Weiner [this message]
2007-04-02 10:23 ` [PATCH] Catch kmalloc() failure in kmem_cache_init() Pekka J Enberg
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=20070402101813.GB5831@saeurebad.de \
--to=hannes-kernel@saeurebad.de \
--cc=akpm@linux-foundation.org \
--cc=christoph@lameter.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®