Clearing ram from VM

adamb

Famous Member
Mar 1, 2012
1,329
77
113
I have made a few posts about VM's with large amount of ram and live migration. After giving it some thought I was thinking I could simply clear what's in ram before the live migration but it looks like the host itself won't let go.

I can run the following on the guest which drops the contents of the ram with no issues
echo 3 > /proc/sys/vm/drop_caches

I then look on the host and the ram is not being released, is there a way I could release the ram from the host so that live migration won't attempt to transfer all the contents, I was really hoping I could just drop cache before a live migration and all would be well.

Is there anytype of kvm commands which could do this for me? I appreciate the input!
 
Looks like I might be able to pull this off if I was to put the memory inside of a balloon and just take it back when I want to do a live migration. So I would need to clear the cache on the guest, then pull the balloon of ram, and kick off a migration. Not exactly what I am looking for, but I think it will work.

Open to any suggestions.
 
I am guessing this mapped memory gets mlocked on the host as I can't even clear it with drop caches on the host. I wish there was a way to unlock these pages, no one has any idea on how memory management works? I guess I should start to look at some kvm lists.