[libvirt] 1GB huge pages and incompatible VM memory size

Michal Privoznik mprivozn at redhat.com
Tue Feb 21 10:23:52 UTC 2017


On 02/13/2017 02:52 AM, Jim Fehlig wrote:
> Hi All,
> 
> Matt encountered the following issue when using 1GB huge pages with libvirt
> 
>> This problem turned out to be entirely my fault because I didn't round
>> the VM's memory size to a 1G multiple, and the kernel tried to split
>> the VMA at the end of the region, triggering this code in the kernel
>> do_mbind() path,
>>
>>   static int __split_vma(struct mm_struct *mm, struct vm_area_struct
>> *vma,
>>                 unsigned long addr, int new_below)
>>   {
>>           struct vm_area_struct *new;
>>           int err;
>>
>>           if (is_vm_hugetlb_page(vma) && (addr &
>>                                          
>> ~(huge_page_mask(hstate_vma(vma)))))
>>                   return -EINVAL;
>>
>> I have no idea how a less fortunate developer without access to MM
>> experts would have figured this out. It's a shame virsh didn't error
>> out when I initially setup 1G hugepages with an incompatible VM memory
>> size.
> 
> What do folks think about improving libvirt to warn or error when using
> a VM memory size that is not compatible with the host hugepage
> configuration?

Jim,

what is the actual problem? I've tried to reproduce this by running vm
with 3.5G RAM backed by 1GB huge pages and the guest runs just fine. I
mean kvm guest. This is because at the cmd line level there is aligned
value:

-m size=4194304k,slots=16,maxmem=8388608k

This is result of qemuDomainAlignMemorySizes(). So perhaps there's a bug
somewhere in the function?

Michal




More information about the libvir-list mailing list