• Rafael Aquini's avatar
    virtio_balloon: introduce migration primitives to balloon pages · e2250429
    Rafael Aquini authored
    Memory fragmentation introduced by ballooning might reduce significantly
    the number of 2MB contiguous memory blocks that can be used within a guest,
    thus imposing performance penalties associated with the reduced number of
    transparent huge pages that could be used by the guest workload.
    
    Besides making balloon pages movable at allocation time and introducing
    the necessary primitives to perform balloon page migration/compaction,
    this patch also introduces the following locking scheme, in order to
    enhance the syncronization methods for accessing elements of struct
    virtio_balloon, thus providing protection against concurrent access
    introduced by parallel memory migration threads.
    
     - balloon_lock (mutex) : synchronizes the access demand to elements of
                              struct virtio_balloon and its queue operations;
    
    [yongjun_wei@trendmicro.com.cn: fix missing unlock on error in fill_balloon()]
    [akpm@linux-foundation.org: avoid having multiple return points in fill_balloon()]
    [akpm@linux-foundation.org: fix printk warning]Signed-off-by: Rafael Aquini <aquini@redhat.com>
    Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    e2250429
virtio_balloon.c 15.7 KB