On 2014/10/17 16:57, Linhaifeng wrote:
> 
> 
> On 2014/10/17 16:33, Daniel P. Berrange wrote:
>> On Fri, Oct 17, 2014 at 04:27:17PM +0800, haifeng....@huawei.com wrote:
>>> From: linhaifeng <haifeng....@huawei.com>
>>>
>>> The VM start with share hugepage should close the hugefile fd
>>> when exit.Because the hugepage fd may be send to other process
>>> e.g vhost-user If qemu not close the fd the other process can
>>> not free the hugepage otherwise exit process,this is ugly,so
>>> qemu should close all shared fd when exit.
>>>
>>> Signed-off-by: linhaifeng <haifeng....@huawei.com>
>>
>> Err, all file descriptors are closed automatically when a process
>> exits. So manually calling close(fd) before exit can't have any
>> functional effect on a resource leak.
>>
>> If QEMU has sent the FD to another process, that process has a
>> completely separate copy of the FD. Closing the FD in QEMU will
>> not close the FD in the other process. You need the other process
>> to exit for the copy to be closed.
>>
>> Regards,
>> Daniel
>>
> Hi,daniel
> 
> QEMU send the fd by unix domain socket.unix domain socket just install the fd 
> to
> other process and inc the f_count,if qemu not close the fd the f_count is not 
> dec.
> Then the other process even close the fd the hugepage would not freed whise 
> the other process exit.
> 
> I have test it for many times.
> 

The point is I want to free the hugepage when close port in vhost-user process 
and not exit.
-- 
Regards,
Haifeng


Reply via email to