Can avic_vm_id_bitmap be made smaller? 2 mbytes feels too large

From: Denys Vlasenko
Date: Wed Jun 21 2017 - 14:29:05 EST


#define AVIC_VM_ID_BITS 24
#define AVIC_VM_ID_NR (1 << AVIC_VM_ID_BITS)
...
static DECLARE_BITMAP(avic_vm_id_bitmap, AVIC_VM_ID_NR);

The above results in a data object which is 2 megabytes large.

avic_vm_init() -> avic_get_next_vm_id() allocates a new vm_id
by looking for a free bit there. That's the whole purpose
for that bitmap existing.

Is there a way to do this less wastefully? Say, such as
iterating over all existing VMs and picking an id which is
not taken.

I imagine VM creation operation is not that frequent, no need
to make new vm_id selection super fast.