Skip to contentSkip to conversation

2.6.25-rc5-git5 KVM memory not freed

DISCUSSION Ioan Ionita 2 participants 5 messages Mar 20, 2008 – Mar 25, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I'm using KVM and the qemu kvm modified to run a windows guest. I'm allocating 900 MB to the guest. Seems that when I terminate a qemu process, the memory that was allocated to qemu is not freed:

Mem:       2058140    1739156     318984          0     226944     425140
-/+ buffers/cache:    1087072     971068

Swap: 0 0 0

So I'm using 1GB of ram even though I've terminated qemu. If I attempt to start qemu again, the machine locks up. No message in the logs.

Command to start qemu:
/usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic -net user -hdb temp.raw -usbdevice tablet

uname -a
Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25 EET 2008 x86_64 GNU/Linux

Not sure whether this is a problem on the kernel side. I don't pretend to understand linux memory management. But it wasn't occurring with older kernels. I'll attempt to bisect.

#1 lore raw
Quoted 18 lines · Ioan Ionita

Hi,

I'm using KVM and the qemu kvm modified to run a windows guest. I'm allocating 900 MB to the guest. Seems that when I terminate a qemu process, the memory that was allocated to qemu is not freed:

Mem:       2058140    1739156     318984          0     226944     425140
-/+ buffers/cache:    1087072     971068

Swap: 0 0 0

So I'm using 1GB of ram even though I've terminated qemu. If I attempt to start qemu again, the machine locks up. No message in the logs.

Command to start qemu:
/usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic -net user -hdb temp.raw -usbdevice tablet

Quoted 9 lines

uname -a
Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25 EET 2008 x86_64 GNU/Linux

Not sure whether this is a problem on the kernel side. I don't pretend to understand linux memory management. But it wasn't occurring with older kernels. I'll attempt to bisect.

I reproduced this and am investigating.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 24 lines · Avi Kivity
Quoted 23 lines · Ioan Ionita

Hi,

I'm using KVM and the qemu kvm modified to run a windows guest. I'm allocating 900 MB to the guest. Seems that when I terminate a qemu process, the memory that was allocated to qemu is not freed:

Mem:       2058140    1739156     318984          0     226944     425140
-/+ buffers/cache:    1087072     971068

Swap: 0 0 0

So I'm using 1GB of ram even though I've terminated qemu. If I attempt to start qemu again, the machine locks up. No message in the logs.

Command to start qemu:
/usr/local/kvm/bin/qemu-system-x86_64 b.data -no-acpi -m 900 -net nic -net user -hdb temp.raw -usbdevice tablet

uname -a
Linux ops-desktop 2.6.25-rc5-git5 #1 SMP PREEMPT Sat Mar 15 14:47:25 EET 2008 x86_64 GNU/Linux

Quoted 8 lines
Quoted 4 lines

Not sure whether this is a problem on the kernel side. I don't pretend to understand linux memory management. But it wasn't occurring with older kernels. I'll attempt to bisect.

I reproduced this and am investigating.

Attached patch ought to fix this.

Signature · 1 line
error compiling committee.c: too many arguments to function
arch/x86/kvm/mmu.c +1 -1
index 4ba85d9..e55af12 100644
@@ -1412,7 +1412,7 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
 	up_read(&current->mm->mmap_sem);
 
 	vcpu->arch.update_pte.gfn = gfn;
-	vcpu->arch.update_pte.page = gfn_to_page(vcpu->kvm, gfn);
+	vcpu->arch.update_pte.page = page;
 }
 
 void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
#3 lore raw
Quoted 1 line · Avi Kivity

Attached patch ought to fix this.

I confirmed! Regression is fixed. Thank you! Will it be pushed upstream for 2.6.25?

Kudos!

#4 lore raw
Quoted 7 lines · Ioan Ionita
Quoted 2 lines · Avi Kivity

Attached patch ought to fix this.

I confirmed! Regression is fixed. Thank you!

Thanks for testing.

Quoted 3 lines

Will it be pushed
upstream for 2.6.25?

Yes, of course.

Signature · 1 line
Any sufficiently difficult bug is indistinguishable from a feature.