Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3935320ybp; Sun, 6 Oct 2019 23:57:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLIcx+axTcj7/kLWKLtSiEQ8V6tw5nGtDuEBzhr09/gXeJDgN9bPrOQVYW2+zFZ1hscKNG X-Received: by 2002:a50:ec81:: with SMTP id e1mr27366582edr.107.1570431470054; Sun, 06 Oct 2019 23:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570431470; cv=none; d=google.com; s=arc-20160816; b=FV2TH4fyk6g5uDvSTF1CE/3qUMaz8Q5cgASvcqVLseEnjmRyZK78uVLD4iHKrOObj2 EFTQj6C5A0xvgtQZU/HABXou5aLLY/l8kfv6hoU4PhvDx9f5PhlwRNK20SW5BIc3IWCd I5nURN2raPsZKI8pUmSVvFV7Alrdr9k2M5L5eEDFjWQGIWp2BsaU8x/OhZNaxGMPIDan ISA7u3inj4sTyMU6//I0SyjZZXdmFDhKxY1K8gRdgQS0i9sSiD3DTcsK8GC+Lb060Uuh dAZ+6LqI78JpveerdY3gljeWniPL2b+Cb5Ek1jFIXQUvHqLd9ZJQnXbtxnknY0SIKClC LUTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=OzZuvYQgEKdfVGafzf9COCV96kEjN+019vA0dKMLw0g=; b=JN+tOKQNdXV5MAop5ACGb7rNT0M5VIqEcl/R3hrb+k1hqufDAM2ryyRoI4FqLg2JyB sbBmFTTPpIE/wjg6ovECPSFcnGnhG/8kk4RmxhkaOcgkKV9IhHhvjECzczUsBytG7Ru4 AFSiyYYtIUgVWPtD4N2m+N3yTaXJs0yn07Cdv5c3oQ3gdk8t86+bQFgSnXaFVpAk0jyo FqDJw0g6YVLuCVBELwzWwsFJbMwf+/SWxWUDY8umo/z+QMNHbWX5ip8szZ9BjKqQKsGt BiQ6ES2xHNVo+c4Hxlh2mtGr5ToOvHwx6hw0gTKawSEI7Aevv9EmU+CZn82Aw10bQPrv IjPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ym1si6635412ejb.263.2019.10.06.23.57.25; Sun, 06 Oct 2019 23:57:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfJGG5X (ORCPT + 99 others); Mon, 7 Oct 2019 02:57:23 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3262 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726202AbfJGG5X (ORCPT ); Mon, 7 Oct 2019 02:57:23 -0400 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-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.7.4