Shrink the guest mem when host don't have enough huge pages

This pullreq use some functions from
 https://github.com/autotest/autotest/pull/704