From patchwork Mon Oct 7 06:57:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfeng Ye X-Patchwork-Id: 11176843 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AE66139A for ; Mon, 7 Oct 2019 06:57:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40FF7214E0 for ; Mon, 7 Oct 2019 06:57:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40FF7214E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 506978E0005; Mon, 7 Oct 2019 02:57:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B7D08E0003; Mon, 7 Oct 2019 02:57:30 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A5108E0005; Mon, 7 Oct 2019 02:57:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 14AFA8E0003 for ; Mon, 7 Oct 2019 02:57:30 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id AC68D180AD803 for ; Mon, 7 Oct 2019 06:57:29 +0000 (UTC) X-FDA: 76016082618.17.geese71_4136e83037c4b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,yeyunfeng@huawei.com,:akpm@linux-foundation.org:rppt@linux.ibm.com:huyue2@yulong.com:peng.fan@nxp.com:aryabinin@virtuozzo.com:ryh.szk.cmnty@gmail.com:andreyknvl@google.com:opendmb@gmail.com:tglx@linutronix.de::linux-kernel@vger.kernel.org,RULES_HIT:30029:30054,0,RBL:45.249.212.191:@huawei.com:.lbl8.mailshell.net-62.18.2.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: geese71_4136e83037c4b X-Filterd-Recvd-Size: 2567 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 7 Oct 2019 06:57:28 +0000 (UTC) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 697CFF29AA39D751D815; Mon, 7 Oct 2019 14:57:20 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Mon, 7 Oct 2019 14:57:18 +0800 Subject: [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation From: Yunfeng Ye To: , , , , , , , , CC: , References: <895d4627-f115-c77a-d454-c0a196116426@huawei.com> Message-ID: <2ab873b7-c754-0af9-f119-f6d435d84767@huawei.com> Date: Mon, 7 Oct 2019 14:57:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <895d4627-f115-c77a-d454-c0a196116426@huawei.com> Content-Language: en-US X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: kzalloc() is used for cma bitmap allocation in cma_activate_area(), switch to bitmap_zalloc() is more clearly. Signed-off-by: Yunfeng Ye --- 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; }