From: Chen Feng <puck.chen@hisilicon.com>
To: <matt@codeblueprint.co.uk>, <ard.biesheuvel@linaro.org>,
<jdelvare@suse.de>, <Sudeep.Holla@arm.com>,
<lorenzo.pieralisi@arm.com>, <ivan.khoronzhuk@globallogic.com>,
<linux-kernel@vger.kernel.org>, <puck.chen@hisilicon.com>,
<yudongbin@hisilicon.com>, <saberlily.xia@hisilicon.com>,
<suzhuangluan@hisilicon.com>, <kong.kongxinwei@hisilicon.com>,
<xuyiping@hisilicon.com>, <z.liuxinliang@hisilicon.com>,
<puck.chen@aliyun.com>, <weidong2@hisilicon.com>,
<w.f@huawei.com>
Cc: <qijiwen@hisilicon.com>, <peter.panshilin@hisilicon.com>,
<dan.zhao@hisilicon.com>, <linuxarm@huawei.com>
Subject: [PATCH] firmware: Change the page arrary alloc to vmalloc
Date: Wed, 16 Dec 2015 16:08:24 +0800 [thread overview]
Message-ID: <1450253304-4156-1-git-send-email-puck.chen@hisilicon.com> (raw)
No need to use use continuous memory, it may be fail
when memory deeply fragmented.
Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
Signed-off-by: Xia Qing <saberlily.xia@hisilicon.com>
---
drivers/base/firmware_class.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8524450..ff8672d 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -257,7 +257,7 @@ static void __fw_free_buf(struct kref *ref)
vunmap(buf->data);
for (i = 0; i < buf->nr_pages; i++)
__free_page(buf->pages[i]);
- kfree(buf->pages);
+ vfree(buf->pages);
} else
#endif
vfree(buf->data);
@@ -660,7 +660,7 @@ static ssize_t firmware_loading_store(struct device *dev,
if (!test_bit(FW_STATUS_DONE, &fw_buf->status)) {
for (i = 0; i < fw_buf->nr_pages; i++)
__free_page(fw_buf->pages[i]);
- kfree(fw_buf->pages);
+ vfree(fw_buf->pages);
fw_buf->pages = NULL;
fw_buf->page_array_size = 0;
fw_buf->nr_pages = 0;
@@ -770,8 +770,7 @@ static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
buf->page_array_size * 2);
struct page **new_pages;
- new_pages = kmalloc(new_array_size * sizeof(void *),
- GFP_KERNEL);
+ new_pages = vmalloc(new_array_size * sizeof(void *));
if (!new_pages) {
fw_load_abort(fw_priv);
return -ENOMEM;
@@ -780,7 +779,7 @@ static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
buf->page_array_size * sizeof(void *));
memset(&new_pages[buf->page_array_size], 0, sizeof(void *) *
(new_array_size - buf->page_array_size));
- kfree(buf->pages);
+ vfree(buf->pages);
buf->pages = new_pages;
buf->page_array_size = new_array_size;
}
--
1.9.1
reply other threads:[~2015-12-16 8:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1450253304-4156-1-git-send-email-puck.chen@hisilicon.com \
--to=puck.chen@hisilicon.com \
--cc=Sudeep.Holla@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dan.zhao@hisilicon.com \
--cc=ivan.khoronzhuk@globallogic.com \
--cc=jdelvare@suse.de \
--cc=kong.kongxinwei@hisilicon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=peter.panshilin@hisilicon.com \
--cc=puck.chen@aliyun.com \
--cc=qijiwen@hisilicon.com \
--cc=saberlily.xia@hisilicon.com \
--cc=suzhuangluan@hisilicon.com \
--cc=w.f@huawei.com \
--cc=weidong2@hisilicon.com \
--cc=xuyiping@hisilicon.com \
--cc=yudongbin@hisilicon.com \
--cc=z.liuxinliang@hisilicon.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 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®