Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp432923imw; Mon, 4 Jul 2022 12:07:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tfgmTsl0e7QA394E+wiOPEGx8O2QzYAr46tGlpO3Tk3gS1kpg9rqKzELEY4PbdnYv3ytwP X-Received: by 2002:a65:6a0e:0:b0:405:2310:22d0 with SMTP id m14-20020a656a0e000000b00405231022d0mr27045532pgu.290.1656961632522; Mon, 04 Jul 2022 12:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656961632; cv=none; d=google.com; s=arc-20160816; b=kHzaWIea4f42ZHG6951hBLGrPtLrA4cvkfdJB80C5QMIN3z/8H/QD5tla3jb79Y6H6 vo5FaBmR+A3RZyiLdqBM8ROpl5Yv5uB8u4HlNN6uEvgVN6toxJyMEBQDU++q6eG5W4E0 eMBjubE93V9qjE4kSrijEfP4ese38v5z+GSEairnBWYSC1vNThQJgaLpDz3OlX//Mg70 Z4oO5HfruKeOSFFy0tlXpXruNrSa9cKfsav4v9fjwvCHOLB3SiUyzu2oBgpu2sJGnaNJ JkFbpzY8DEBNlLxRm3BS/RyWA8ww5N1TF8JGh2PMdkAFoqeBYtj5z8PnYNE3c6esxFQd B9+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ljBhjkuJqcdKMp/CNsIB1SmdCvmQbbJo3UdcuEkwYIY=; b=cUDdLCUyrfR62Y3PuY2Zzkj3+LUwgEYwpst9dsTm8q1hDVQfuldpVIlpxdyUEDqdFR rCjRIp/HKNpg7QxAmMGK6SorlfJzr4r3yuBHBLEnNUCxszY9RW6RwZp4ZxngMyUT8t+1 ETEis9YHapULAdd0QYqfLrVeWzOGrqnkU/VeQANVfCsKhF4mK0lx7qvxkDaQtam7V5fS /qXZQMfS7+9ZbUpKI9O3JsG8t6Ik5zp9MrC5r+L00V0G6Y5H2wjRcWMku4piiuSIlhF8 NExsCjrScojp9Gr+rWaZQRYLEdE9E2TY5ouMghQZjyh5Hg8IwmhZGpYuU7u9PeyyFlqA K3pA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a056a00158300b0050fea04c5fbsi4192491pfk.42.2022.07.04.12.07.00; Mon, 04 Jul 2022 12:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234459AbiGDTEH (ORCPT + 99 others); Mon, 4 Jul 2022 15:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbiGDTDy (ORCPT ); Mon, 4 Jul 2022 15:03:54 -0400 Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B223312A85 for ; Mon, 4 Jul 2022 12:03:31 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 8RM0oVexLeg3p8RM0oCUri; Mon, 04 Jul 2022 21:03:29 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Mon, 04 Jul 2022 21:03:29 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Thomas Bogendoerfer Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mips@vger.kernel.org Subject: [PATCH] MIPS: mm: Use the bitmap API to allocate bitmaps Date: Mon, 4 Jul 2022 21:03:27 +0200 Message-Id: <4b6493bfee4f1c2d30193df01e67052922703b95.1656961396.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. While at it, turn a bitmap_clear() into an equivalent bitmap_zero(). It is also less verbose. Signed-off-by: Christophe JAILLET --- arch/mips/mm/context.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/mips/mm/context.c b/arch/mips/mm/context.c index b25564090939..966f40066f03 100644 --- a/arch/mips/mm/context.c +++ b/arch/mips/mm/context.c @@ -67,7 +67,7 @@ static void flush_context(void) int cpu; /* Update the list of reserved MMIDs and the MMID bitmap */ - bitmap_clear(mmid_map, 0, num_mmids); + bitmap_zero(mmid_map, num_mmids); /* Reserve an MMID for kmap/wired entries */ __set_bit(MMID_KERNEL_WIRED, mmid_map); @@ -277,8 +277,7 @@ static int mmid_init(void) WARN_ON(num_mmids <= num_possible_cpus()); atomic64_set(&mmid_version, asid_first_version(0)); - mmid_map = kcalloc(BITS_TO_LONGS(num_mmids), sizeof(*mmid_map), - GFP_KERNEL); + mmid_map = bitmap_zalloc(num_mmids, GFP_KERNEL); if (!mmid_map) panic("Failed to allocate bitmap for %u MMIDs\n", num_mmids); -- 2.34.1