提交 4f02e8f3 编写于 作者: Z Zhou Guanghui 提交者: Yang Yingliang

ascend/svm: Support pinned memory size greater than 2GB

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4DZ7Q
CVE: NA

-------------------------------------------------

If the memory size of a single pin operation exceeds 2GB,
the memory size required for storing pages exceeds 4MB.
In this case, the allocation using kcalloc fails.
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 36b945bb
......@@ -346,7 +346,7 @@ static void svm_remove_sdma(struct svm_process *process,
if (null_count)
dump_stack();
kfree(sdma->pages);
kvfree(sdma->pages);
kfree(sdma);
}
......@@ -381,7 +381,7 @@ static int svm_add_sdma(struct svm_process *process,
sdma->addr = addr & PAGE_MASK;
sdma->nr_pages = (PAGE_ALIGN(size + addr) >> PAGE_SHIFT) -
(sdma->addr >> PAGE_SHIFT);
sdma->pages = kcalloc(sdma->nr_pages, sizeof(char *), GFP_KERNEL);
sdma->pages = kvcalloc(sdma->nr_pages, sizeof(char *), GFP_KERNEL);
if (sdma->pages == NULL) {
err = -ENOMEM;
goto err_free_sdma;
......@@ -411,7 +411,7 @@ static int svm_add_sdma(struct svm_process *process,
while (sdma->nr_pages--)
put_page(sdma->pages[sdma->nr_pages]);
err_free_pages:
kfree(sdma->pages);
kvfree(sdma->pages);
err_free_sdma:
kfree(sdma);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册