From: gaoxu <gaoxu2@hihonor.com>
To: "hch@lst.de" <hch@lst.de>,
"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>
Cc: "robin.murphy@arm.com" <robin.murphy@arm.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"surenb@google.com" <surenb@google.com>,
yipengxiang <yipengxiang@hihonor.com>,
wangbintian 00013160 <bintian.wang@hihonor.com>
Subject: RE: [PATCH] dma-remap: Use kvmalloc_array/kvfree for larger dma memory remap
Date: Mon, 15 May 2023 06:59:31 +0000 [thread overview]
Message-ID: <a37f80a55eeb4b2eb125e3340320032e@hihonor.com> (raw)
In-Reply-To: <18448ae569e24dfd84e811081ede376f@hihonor.com>
Please help to review, thanks.
-----Original Message-----
From: gaoxu 00016977
Sent: 2023年5月6日 15:34
To: 'hch@lst.de' <hch@lst.de>; 'm.szyprowski@samsung.com' <m.szyprowski@samsung.com>
Cc: 'robin.murphy@arm.com' <robin.murphy@arm.com>; 'iommu@lists.linux.dev' <iommu@lists.linux.dev>; 'linux-kernel@vger.kernel.org' <linux-kernel@vger.kernel.org>; 'surenb@google.com' <surenb@google.com>; yipengxiang 00013268 <yipengxiang@hihonor.com>; wangbintian 00013160 <bintian.wang@hihonor.com>; hanfeng 00012985 <feng.han@hihonor.com>
Subject: [PATCH] dma-remap: Use kvmalloc_array/kvfree for larger dma memory remap
If dma_direct_alloc() alloc memory in size of 64MB, the inner function
dma_common_contiguous_remap() will allocate 128KB memory by invoking the function kmalloc_array(). and the kmalloc_array seems to fail to try to allocate 128KB mem. work around by doing kvmalloc_array instead.
Signed-off-by: Gao Xu <gaoxu2@hihonor.com>
---
kernel/dma/remap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index b45266680..27596f3b4 100644
--- a/kernel/dma/remap.c
+++ b/kernel/dma/remap.c
@@ -43,13 +43,13 @@ void *dma_common_contiguous_remap(struct page *page, size_t size,
void *vaddr;
int i;
- pages = kmalloc_array(count, sizeof(struct page *), GFP_KERNEL);
+ pages = kvmalloc_array(count, sizeof(struct page *), GFP_KERNEL);
if (!pages)
return NULL;
for (i = 0; i < count; i++)
pages[i] = nth_page(page, i);
vaddr = vmap(pages, count, VM_DMA_COHERENT, prot);
- kfree(pages);
+ kvfree(pages);
return vaddr;
}
--
2.17.1
next prev parent reply other threads:[~2023-05-15 7:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-06 7:33 [PATCH] dma-remap: Use kvmalloc_array/kvfree for larger dma memory remap gaoxu 00016977
2023-05-15 6:59 ` gaoxu [this message]
2023-05-16 19:41 ` Suren Baghdasaryan
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=a37f80a55eeb4b2eb125e3340320032e@hihonor.com \
--to=gaoxu2@hihonor.com \
--cc=bintian.wang@hihonor.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=surenb@google.com \
--cc=yipengxiang@hihonor.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