From patchwork Tue Sep 1 15:09:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F561C433E7 for ; Tue, 1 Sep 2020 16:35:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 596082065F for ; Tue, 1 Sep 2020 16:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598978150; bh=kPvXC1q2GmkliQciWKKb/LdEJYKqO3ID4Wsv5KP+0Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sYXicVUjqKSUwSJXcp0Q8eAA7CORYV03jZpWkM1EEKJmGQ11R0eDWBofOw9dDFjsc zT4qmU84mvqQrk51pcCnXy4u4Mvr2yn0HQR/8/KUN8z+ZADnbIbTWvwo8rss2v+7Xm Kq8b/HdFbycenuBLPrj6q+M21EJGiayxCKK8xLo0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730307AbgIAP37 (ORCPT ); Tue, 1 Sep 2020 11:29:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:59900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730567AbgIAP35 (ORCPT ); Tue, 1 Sep 2020 11:29:57 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8AB752078B; Tue, 1 Sep 2020 15:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974197; bh=kPvXC1q2GmkliQciWKKb/LdEJYKqO3ID4Wsv5KP+0Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJOAwYpX/aj79Ax9quO/wk+jbX60ITBMR5GJTGf8/Zmyebw7RfCeoSRvNcG/M156y 9wOvwZJ5X1OYssld/lPfJaEMTmuf+OwHaG+oger94G3jYgqCRqVdei4itoTOwkwXzs FSUp5D67D6gk+bChaFB7sPA4/Z8sfcFKqar1qWZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunfeng Ye , Andrew Morton , Mike Rapoport , Yue Hu , Peng Fan , Andrey Ryabinin , Ryohei Suzuki , Andrey Konovalov , Doug Berger , Thomas Gleixner , Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 082/214] mm/cma.c: switch to bitmap_zalloc() for cma bitmap allocation Date: Tue, 1 Sep 2020 17:09:22 +0200 Message-Id: <20200901150956.926570179@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yunfeng Ye [ Upstream commit 2184f9928ab52f26c2ae5e9ba37faf29c78f50b8 ] kzalloc() is used for cma bitmap allocation in cma_activate_area(), switch to bitmap_zalloc() for clarity. Link: http://lkml.kernel.org/r/895d4627-f115-c77a-d454-c0a196116426@huawei.com Signed-off-by: Yunfeng Ye Reviewed-by: Andrew Morton Cc: Mike Rapoport Cc: Yue Hu Cc: Peng Fan Cc: Andrey Ryabinin Cc: Ryohei Suzuki Cc: Andrey Konovalov Cc: Doug Berger Cc: Thomas Gleixner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/cma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/cma.c b/mm/cma.c index 7fe0b8356775f..be55d1988c675 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; }