Skip to contentSkip to conversation

riscv: mm: Use better bitmap_zalloc()

PATCH In review Kefeng Wang 2 participants 2 messages May 29, 2021 – Jun 9, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: mm: Use better bitmap_zalloc()

Use better bitmap_zalloc() to allocate bitmap.

Cc Palmer Dabbelt <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
---
 arch/riscv/mm/context.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/riscv/mm/context.c +1 -2
index 83e7ae37675a..2aba0a6343d9 100644
@@ -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);
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#1 lore raw
Quoted 16 lines · On Sat, 29 May 2021 04:15:34 PDT (-0700), [email protected] wrote:

Use better bitmap_zalloc() to allocate bitmap.

Cc Palmer Dabbelt <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
---
 arch/riscv/mm/context.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/riscv/mm/context.c +0 -0
index 83e7ae37675a..2aba0a6343d9 100644

arch/riscv/mm/context.c static int asids_init(void) · line 249

Quoted 9 lines
arch/riscv/mm/context.c +1 -2
@@ -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.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv