Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5538362ybn; Sun, 29 Sep 2019 00:14:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwKHL7a2K4Y8/22dfnqRgt7WuSLJ78Fe9BWD0hIP1etsCjQbXD89rDhHf9Vk708Yvst4o3 X-Received: by 2002:a17:906:8c8:: with SMTP id o8mr14876238eje.56.1569741299560; Sun, 29 Sep 2019 00:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569741299; cv=none; d=google.com; s=arc-20160816; b=rjgAn8x03Bw6diQkwZERjxF/XlyPO7r3CxHICGWDOOoEJboBgrWX6Rbhg7ibgHyWZp uUT3EGA8AHHkZpDp+PwwTKZNv3E77t8xr5mPLio4UKXhG3oSHESyOjp3w3mCUWy5H14a 6MVbKD8qS48lio4k9ldqNPOielDj9r5/7Imu+sfSg/VjsJBCYchCvf0KrCk73VrKrhb3 2UbtJwq7rXOIqiYZqgEEjKFtc4tgCy0G5QPavF66Zzlc5h+MInY4+yNKJXBSTaHEkTC6 i9xny8vCUITMQLFS6wx38tSXGoo9Q8ceqqbZefjJ/9aLYGRrxVuDK7LjpNHBUXLiLpqZ xM+A== 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:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=OzZuvYQgEKdfVGafzf9COCV96kEjN+019vA0dKMLw0g=; b=kn7/feu+S16PbsnScfLc3TBCCIx2dDeQlMBwdTZoMPtRqfOLNQlxCFEa5hXNl0kiwL T53yuhzTaNiKsDCrK4xF+x3vX5rEVfTdCDs+obMFwehejW/SX6TYoK8tpMz9ZfmqOnr7 um/FQZLx9+vcgQxx/JsRBMumslCbXGVKJbi4jH2NGDtIbU6EE/OfsBPWANa3LPwp7/XX iNFxxPTvocJRZ3bLQphHbcMclkuGdtiTKwDZ1DuykyxupgqNMWO7KFMnn5GVNW9dKSKg JACk+5B0QfHaefESnBcCx8lbPeiScmiyyBtYN+OVHbJYIfcKJUQ13HM3J3R/Tvs+t1le fYdQ== 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 f31si5186487ede.253.2019.09.29.00.14.24; Sun, 29 Sep 2019 00:14:59 -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 S1726579AbfI2HMv (ORCPT + 99 others); Sun, 29 Sep 2019 03:12:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3170 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725379AbfI2HMv (ORCPT ); Sun, 29 Sep 2019 03:12:51 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6710E277A1ABB008877D; Sun, 29 Sep 2019 15:12:46 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Sun, 29 Sep 2019 15:12:41 +0800 To: , , , , , , , , CC: , From: Yunfeng Ye Subject: [PATCH] mm/cma.c: Switch to bitmap_zalloc() for cma bitmap allocation Message-ID: <895d4627-f115-c77a-d454-c0a196116426@huawei.com> Date: Sun, 29 Sep 2019 15:12:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 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