* [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation
@ 2019-09-29 7:12 Yunfeng Ye
2019-10-07 6:57 ` Yunfeng Ye
0 siblings, 1 reply; 2+ messages in thread
From: Yunfeng Ye @ 2019-09-29 7:12 UTC (permalink / raw)
To: akpm, rppt, huyue2, peng.fan, aryabinin, ryh.szk.cmnty,
andreyknvl, opendmb, tglx
Cc: linux-mm, linux-kernel
kzalloc() is used for cma bitmap allocation in cma_activate_area(),
switch to bitmap_zalloc() is more clearly.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
mm/cma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/cma.c b/mm/cma.c
index 7fe0b83..be55d19 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -95,13 +95,11 @@ static void cma_clear_bitmap(struct cma *cma, unsigned long pfn,
static int __init cma_activate_area(struct cma *cma)
{
- int bitmap_size = BITS_TO_LONGS(cma_bitmap_maxno(cma)) * sizeof(long);
unsigned long base_pfn = cma->base_pfn, pfn = base_pfn;
unsigned i = cma->count >> pageblock_order;
struct zone *zone;
- cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
-
+ cma->bitmap = bitmap_zalloc(cma_bitmap_maxno(cma), GFP_KERNEL);
if (!cma->bitmap) {
cma->count = 0;
return -ENOMEM;
@@ -139,7 +137,7 @@ static int __init cma_activate_area(struct cma *cma)
not_in_zone:
pr_err("CMA area %s could not be activated\n", cma->name);
- kfree(cma->bitmap);
+ bitmap_free(cma->bitmap);
cma->count = 0;
return -EINVAL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation
2019-09-29 7:12 [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation Yunfeng Ye
@ 2019-10-07 6:57 ` Yunfeng Ye
0 siblings, 0 replies; 2+ messages in thread
From: Yunfeng Ye @ 2019-10-07 6:57 UTC (permalink / raw)
To: akpm, rppt, huyue2, peng.fan, aryabinin, ryh.szk.cmnty,
andreyknvl, opendmb, tglx
Cc: linux-mm, linux-kernel
kzalloc() is used for cma bitmap allocation in cma_activate_area(),
switch to bitmap_zalloc() is more clearly.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
mm/cma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/cma.c b/mm/cma.c
index 7fe0b83..be55d19 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -95,13 +95,11 @@ static void cma_clear_bitmap(struct cma *cma, unsigned long pfn,
static int __init cma_activate_area(struct cma *cma)
{
- int bitmap_size = BITS_TO_LONGS(cma_bitmap_maxno(cma)) * sizeof(long);
unsigned long base_pfn = cma->base_pfn, pfn = base_pfn;
unsigned i = cma->count >> pageblock_order;
struct zone *zone;
- cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
-
+ cma->bitmap = bitmap_zalloc(cma_bitmap_maxno(cma), GFP_KERNEL);
if (!cma->bitmap) {
cma->count = 0;
return -ENOMEM;
@@ -139,7 +137,7 @@ static int __init cma_activate_area(struct cma *cma)
not_in_zone:
pr_err("CMA area %s could not be activated\n", cma->name);
- kfree(cma->bitmap);
+ bitmap_free(cma->bitmap);
cma->count = 0;
return -EINVAL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-07 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29 7:12 [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation Yunfeng Ye
2019-10-07 6:57 ` Yunfeng Ye
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).