diff mbox series

riscv: mm: Use better bitmap_zalloc()

Message ID 20210529111534.186534-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series riscv: mm: Use better bitmap_zalloc() | expand

Commit Message

Kefeng Wang May 29, 2021, 11:15 a.m. UTC
Use better bitmap_zalloc() to allocate bitmap.

Cc: Palmer Dabbelt <palmerdabbelt@google.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/riscv/mm/context.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Palmer Dabbelt June 9, 2021, 12:12 a.m. UTC | #1
On Sat, 29 May 2021 04:15:34 PDT (-0700), wangkefeng.wang@huawei.com wrote:
> Use better bitmap_zalloc() to allocate bitmap.
>
> Cc: Palmer Dabbelt <palmerdabbelt@google.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: linux-riscv@lists.infradead.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  arch/riscv/mm/context.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/riscv/mm/context.c b/arch/riscv/mm/context.c
> index 83e7ae37675a..2aba0a6343d9 100644
> --- a/arch/riscv/mm/context.c
> +++ b/arch/riscv/mm/context.c
> @@ -243,8 +243,7 @@ static int asids_init(void)
>  	if (num_asids > (2 * num_possible_cpus())) {
>  		atomic_long_set(&current_version, num_asids);
>
> -		context_asid_map = kcalloc(BITS_TO_LONGS(num_asids),
> -				   sizeof(*context_asid_map), GFP_KERNEL);
> +		context_asid_map = bitmap_zalloc(num_asids, GFP_KERNEL);
>  		if (!context_asid_map)
>  			panic("Failed to allocate bitmap for %lu ASIDs\n",
>  			      num_asids);

Thanks, this is on for-next.
diff mbox series

Patch

diff --git a/arch/riscv/mm/context.c b/arch/riscv/mm/context.c
index 83e7ae37675a..2aba0a6343d9 100644
--- a/arch/riscv/mm/context.c
+++ b/arch/riscv/mm/context.c
@@ -243,8 +243,7 @@  static int asids_init(void)
 	if (num_asids > (2 * num_possible_cpus())) {
 		atomic_long_set(&current_version, num_asids);
 
-		context_asid_map = kcalloc(BITS_TO_LONGS(num_asids),
-				   sizeof(*context_asid_map), GFP_KERNEL);
+		context_asid_map = bitmap_zalloc(num_asids, GFP_KERNEL);
 		if (!context_asid_map)
 			panic("Failed to allocate bitmap for %lu ASIDs\n",
 			      num_asids);