Bug 438603

Summary: KVM does not free allocated memory
Product: [Fedora] Fedora Reporter: Ralf Ertzinger <redhat-bugzilla>
Component: kvmAssignee: Jeremy Katz <katzj>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: berrange, clalance
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-31 15:21:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralf Ertzinger 2008-03-22 18:08:12 UTC
Description of problem:
Stopping a kvm-enabled virtual machine does not free the memory allocated to
that machine, the memory is essentially lost until the kernel is rebooted.

Looks like this:
[sun@lain ~/xen/xos :) 38]$ free
             total       used       free     shared    buffers     cached
Mem:       3084812    2362980     721832          0      54752    1417440
-/+ buffers/cache:     890788    2194024
Swap:      1015800          0    1015800
[sun@lain ~/xen/xos :) 40]$ sudo ./start
(this essentially starts qemu-kvm with the necessary parameters, this machine
has 256MB RAM allocated)
config qemu network with bridge for  tap1
^C
[sun@lain ~/xen/xos :( (1) 41]$ free
             total       used       free     shared    buffers     cached
Mem:       3084812    2615736     469076          0      55368    1416820
-/+ buffers/cache:    1143548    1941264
Swap:      1015800          0    1015800

As can be seen, the "used" memory has increased by roughly 256MB.

Version-Release number of selected component (if applicable):
kvm-63-2.fc9.i386
kernel-PAE-2.6.25-0.136.rc6.git5.fc9.i686


How reproducible:
Always

Steps to Reproduce:
1. see above
2.
3.
  
Actual results:
Memory for the virtual machine is never freed

Expected results:
Memory for the virtual machine is freed after machine shutdown

Additional info:

Comment 1 Daniel Berrangé 2008-03-23 13:52:03 UTC
Bug in 2.6.25-fc5 kernel, patch on kvm-devel

http://article.gmane.org/gmane.comp.emulators.kvm.devel/14867

Comment 2 Jeremy Katz 2008-03-24 01:07:21 UTC
As Dan says, this is being discussed on kvm-devel.  Although apparently that
patch isn't quite enough to fix it.  Once there's a fix in the thread, I'll make
sure it gets into our kernels.

Comment 3 Jeremy Katz 2008-03-31 15:21:44 UTC
Should be fixed with current kernels (we added the patch, then took in the
upstream version)