qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Bug?]When close VM the hugepage not freed


From: Linhaifeng
Subject: Re: [Qemu-devel] [Bug?]When close VM the hugepage not freed
Date: Wed, 15 Oct 2014 09:32:22 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0


On 2014/10/14 20:08, Daniel P. Berrange wrote:
> On Tue, Oct 14, 2014 at 08:02:38PM +0800, Linhaifeng wrote:
>> Hi,all
>>
>> I was trying to use hugepage with VM and found that the hugepage not freed 
>> when close VM.
>>
>>
>> 1.Before start VM the /proc/meminfo is:
>> AnonHugePages:    124928 kB
>> HugePages_Total:    4096
>> HugePages_Free:     3072
>> HugePages_Rsvd:        0
>> HugePages_Surp:        0
>> Hugepagesize:       2048 kB
>>
>> 2.Start VM the /proc/meminfo is:
>> AnonHugePages:    139264 kB
>> HugePages_Total:    4096
>> HugePages_Free:     2048
>> HugePages_Rsvd:        0
>> HugePages_Surp:        0
>> Hugepagesize:       2048 kB
>>
>> 3.Close VM the /proc/meminfo is:
>> AnonHugePages:    124928 kB
>> HugePages_Total:    4096
>> HugePages_Free:     2048
>> HugePages_Rsvd:        0
>> HugePages_Surp:        0
>> Hugepagesize:       2048 kB
>>
>> We can see there are 1024 hugepage leak!
>>
>> I try to found which function used to free hugepage but i'm not sure
>> where the qemu_ram_free is the function to free hugepage.
>> I found that the qemu_ram_free function not call unlink and we know
>> unlink is used to free hugepage(see example of hugepage-mmap.c in
>> kernel source).
> 
> We can't rely on 'qemu_ram_free' ever executing because we must
> ensure hugepages are freed upon QEMU crash.
> 
> It seems we should rely on UNIX filesytstem semantics and simply
> unlink the memory segment the moment we create it & open the FD.
> That way the kernel will automatically free it when the FD is
> closed when QEMU process exits.
> 
> 
> Regards,
> Daniel
> 

Hi, daniel

Thank you for your answer.

Does it means libvirt should free the hugepage?

QEMU create the hugepage with template file and unlink it before mmap.
Do you know why to unlink the hugepage before mmap?

When unlink the hugepage before mmap libvirt cannot found the hugepage.
How does libvirt to free the hugepage ?

Regards,
Haifeng




reply via email to

[Prev in Thread] Current Thread [Next in Thread]