kvm: irqchip: Break up high order allocations of kvm_irq_routing_table
authorJoerg Roedel <jroedel@suse.de>
Fri, 8 May 2015 12:31:44 +0000 (14:31 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Jun 2015 15:16:25 +0000 (17:16 +0200)
commite73f61e41f3bb9bc453fd9c21b82d0b89c2b83e7
tree83de18fd1a1c68c9fd14762e2b6a7faa0cd8d728
parent05fe125fa3237de2ec5bada80031e694de78909c
kvm: irqchip: Break up high order allocations of kvm_irq_routing_table

The allocation size of the kvm_irq_routing_table depends on
the number of irq routing entries because they are all
allocated with one kzalloc call.

When the irq routing table gets bigger this requires high
order allocations which fail from time to time:

qemu-kvm: page allocation failure: order:4, mode:0xd0

This patch fixes this issue by breaking up the allocation of
the table and its entries into individual kzalloc calls.
These could all be satisfied with order-0 allocations, which
are less likely to fail.

The downside of this change is the lower performance, because
of more calls to kzalloc. But given how often kvm_set_irq_routing
is called in the lifetime of a guest, it doesn't really
matter much.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
[Avoid sparse warning through rcu_access_pointer. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/irqchip.c