• Nadav Amit's avatar
    vmw_balloon: Add memory shrinker · 5d1a86ec
    Nadav Amit authored
    Add a shrinker to the VMware balloon to prevent out-of-memory events.
    We reuse the deflate logic for this matter. Deadlocks should not happen,
    as no memory allocation is performed while the locks of the
    communication (batch/page) and page-list are taken. In the unlikely
    event in which the configuration semaphore is taken for write we bail
    out and fail gracefully (causing processes to be killed).
    
    Once the shrinker is called, inflation is postponed for few seconds.
    The timeout is updated without any lock, but this should not cause any
    races, as it is written and read atomically.
    
    This feature is disabled by default, since it might cause performance
    degradation.
    Reviewed-by: default avatarXavier Deguillard <xdeguillard@vmware.com>
    Signed-off-by: default avatarNadav Amit <namit@vmware.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    5d1a86ec
vmw_balloon.c 53.6 KB