Skip to content
  • Igor Mammedov's avatar
    vhost: extend memory regions allocation to vmalloc · 4de7255f
    Igor Mammedov authored
    
    
    with large number of memory regions we could end up with
    high order allocations and kmalloc could fail if
    host is under memory pressure.
    Considering that memory regions array is used on hot path
    try harder to allocate using kmalloc and if it fails resort
    to vmalloc.
    It's still better than just failing vhost_set_memory() and
    causing guest crash due to it when a new memory hotplugged
    to guest.
    
    I'll still look at QEMU side solution to reduce amount of
    memory regions it feeds to vhost to make things even better,
    but it doesn't hurt for kernel to behave smarter and don't
    crash older QEMU's which could use large amount of memory
    regions.
    
    Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    4de7255f