From: Yinghai Lu <Yinghai.Lu@Sun.COM>
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] mm: fix dma_poor_create
Date: Tue, 19 Feb 2008 18:45:28 -0800 [thread overview]
Message-ID: <200802191845.28802.yinghai.lu@sun.com> (raw)
dev_to_node could return node that without RAM. So check it before use it in kmalloc_node
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/mm/dmapool.c b/mm/dmapool.c
index 34aaac4..6be5b5a 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -128,6 +128,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
{
struct dma_pool *retval;
size_t allocation;
+ int node;
if (align == 0) {
align = 1;
@@ -152,7 +153,11 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
return NULL;
}
- retval = kmalloc_node(sizeof(*retval), GFP_KERNEL, dev_to_node(dev));
+ node = dev_to_node(dev);
+ if (node == -1 || !node_online(node))
+ node = numa_node_id();
+
+ retval = kmalloc_node(sizeof(*retval), GFP_KERNEL, node);
if (!retval)
return retval;
next reply other threads:[~2008-02-20 2:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 2:45 Yinghai Lu [this message]
2008-02-20 6:52 ` Ingo Molnar
2008-02-20 7:50 ` Yinghai Lu
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=200802191845.28802.yinghai.lu@sun.com \
--to=yinghai.lu@sun.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Powered by JetHome