2008-03-20 16:42:16

by Ioan Ionita

[permalink] [raw]
Subject: 2.6.25-rc5-git5 KVM memory not freed

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.


2008-03-23 10:31:19

by Avi Kivity

[permalink] [raw]
Subject: Re: 2.6.25-rc5-git5 KVM memory not freed

Ioan Ionita wrote:
> 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.
>

I reproduced this and am investigating.


--
error compiling committee.c: too many arguments to function

2008-03-23 12:21:10

by Avi Kivity

[permalink] [raw]
Subject: Re: 2.6.25-rc5-git5 KVM memory not freed

Avi Kivity wrote:
> Ioan Ionita wrote:
>> 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.
>>
>
> I reproduced this and am investigating.
>
>

Attached patch ought to fix this.

--
error compiling committee.c: too many arguments to function


Attachments:
fix-kvm-2.6.25-rc6-leak.patch (463.00 B)

2008-03-24 23:30:46

by Ioan Ionita

[permalink] [raw]
Subject: Re: 2.6.25-rc5-git5 KVM memory not freed

On Sun, Mar 23, 2008 at 2:20 PM, Avi Kivity <[email protected]> wrote:

> Attached patch ought to fix this.

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

Kudos!

2008-03-25 06:21:38

by Avi Kivity

[permalink] [raw]
Subject: Re: 2.6.25-rc5-git5 KVM memory not freed

Ioan Ionita wrote:
> On Sun, Mar 23, 2008 at 2:20 PM, Avi Kivity <[email protected]> wrote:
>
>
>> Attached patch ought to fix this.
>>
>
> I confirmed! Regression is fixed. Thank you!

Thanks for testing.

> Will it be pushed
> upstream for 2.6.25?
>

Yes, of course.

--
Any sufficiently difficult bug is indistinguishable from a feature.