[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <895d4627-f115-c77a-d454-c0a196116426@huawei.com>
Date: Sun, 29 Sep 2019 15:12:14 +0800
From: Yunfeng Ye <yeyunfeng@...wei.com>
To: <akpm@...ux-foundation.org>, <rppt@...ux.ibm.com>,
<huyue2@...ong.com>, <peng.fan@....com>, <aryabinin@...tuozzo.com>,
<ryh.szk.cmnty@...il.com>, <andreyknvl@...gle.com>,
<opendmb@...il.com>, <tglx@...utronix.de>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation
kzalloc() is used for cma bitmap allocation in cma_activate_area(),
switch to bitmap_zalloc() is more clearly.
Signed-off-by: Yunfeng Ye <yeyunfeng@...wei.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
Powered by blists - more mailing lists