Skip to content

Commit

Permalink
KVM: arm64: Use the bitmap API to allocate bitmaps
Browse files Browse the repository at this point in the history
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/3c5043731db4d3635383e9326bc7e98e25de3288.1681854412.git.christophe.jaillet@wanadoo.fr
  • Loading branch information
Christophe JAILLET authored and Marc Zyngier committed Apr 20, 2023
1 parent 4be8ddb commit a00e9e4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions arch/arm64/kvm/vmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ int __init kvm_arm_vmid_alloc_init(void)
*/
WARN_ON(NUM_USER_VMIDS - 1 <= num_possible_cpus());
atomic64_set(&vmid_generation, VMID_FIRST_VERSION);
vmid_map = kcalloc(BITS_TO_LONGS(NUM_USER_VMIDS),
sizeof(*vmid_map), GFP_KERNEL);
vmid_map = bitmap_zalloc(NUM_USER_VMIDS, GFP_KERNEL);
if (!vmid_map)
return -ENOMEM;

Expand All @@ -192,5 +191,5 @@ int __init kvm_arm_vmid_alloc_init(void)

void __init kvm_arm_vmid_alloc_free(void)
{
kfree(vmid_map);
bitmap_free(vmid_map);
}

0 comments on commit a00e9e4

Please sign in to comment.