WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Xen 4.0.1 "xc_map_foreign_batch: mmap failed: Cannot all

To: "Charles Arnold" <CARNOLD@xxxxxxxxxx>
Subject: Re: [Xen-devel] Xen 4.0.1 "xc_map_foreign_batch: mmap failed: Cannot allocate memory"
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 07 Jan 2011 09:35:05 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, stefano.stabellini@xxxxxxxxxxxxx
Delivery-date: Fri, 07 Jan 2011 01:35:47 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 06.01.11 at 21:49, Charles Arnold wrote:
> >>> On 1/6/2011 at 10:14 AM, in message <4D25C782.5B74.0091.0@xxxxxxxxxx>, 
> >>> Charles Arnold wrote: 
> Attached is the messages file with the printk output.

Hmm, a failure due to may_expand_vm() is really odd. Something
must be explicitly setting a non-infinite RLIMIT_AS on qemu-dm (or
one of its parents), as the default is "infinite" (as reaching "infinity"
- being ~0UL - is simply impossible, and unduly large lengths should
be caught by get_unmapped_area() already).

/proc/<pid>/limits would at least tell us what the limit is.

And certainly qemu-dm needs to be prepared to have a
non-infinite address space limit set on it.

Jan - Charles
> 
>>> ---
>>> 
>>> 
>>> 
>>> diff --git a/mm/mmap.c b/mm/mmap.c
>>> index b179abb..3f65277 100644
>>> --- a/mm/mmap.c
>>> +++ b/mm/mmap.c
>>> @@ -991,16 +991,20 @@ unsigned long do_mmap_pgoff(struct file *file, 
>>> unsigned 
> 
>> 
>>> long addr,
>>>  
>>>     /* Careful about overflows.. */
>>>     len = PAGE_ALIGN(len);
>>> -   if (!len)
>>> +   if (!len) {
>>> +           printk("DEBUG PAGE_ALIGN ENOMEM\n");
>>>             return -ENOMEM;
>>> +   }
>>>  
>>>     /* offset overflow? */
>>>     if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
>>>                 return -EOVERFLOW;
>>>  
>>>     /* Too many mappings? */
>>> -   if (mm->map_count > sysctl_max_map_count)
>>> +   if (mm->map_count > sysctl_max_map_count) {
>>> +           printk("DEBUG too many mappings ENOMEM\n");
>>>             return -ENOMEM;
>>> +   }
>>>  
>>>     /* Obtain the address to map to. we verify (or select) it and ensure
>>>      * that it represents a valid section of the address space.
>>> @@ -1231,14 +1235,18 @@ unsigned long mmap_region(struct file *file, 
>>> unsigned 
> 
>> 
>>> long addr,
>>>  munmap_back:
>>>     vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
>>>     if (vma && vma->vm_start < addr + len) {
>>> -           if (do_munmap(mm, addr, len))
>>> +           if (do_munmap(mm, addr, len)) {
>>> +                   printk("DEBUG find_vma_prepare ENOMEM\n");
>>>                     return -ENOMEM;
>>> +           }
>>>             goto munmap_back;
>>>     }
>>>  
>>>     /* Check against address space limit. */
>>> -   if (!may_expand_vm(mm, len >> PAGE_SHIFT))
>>> +   if (!may_expand_vm(mm, len >> PAGE_SHIFT)) {
>>> +           printk("DEBUG may_expand_vm ENOMEM\n");
>>>             return -ENOMEM;
>>> +   }
>>>  
>>>     /*
>>>      * Set 'VM_NORESERVE' if we should not account for the
>>> @@ -1259,8 +1267,10 @@ munmap_back:
>>>      */
>>>     if (accountable_mapping(file, vm_flags)) {
>>>             charged = len >> PAGE_SHIFT;
>>> -           if (security_vm_enough_memory(charged))
>>> +           if (security_vm_enough_memory(charged)) {
>>> +                   printk("DEBUG accountable_mapping ENOMEM\n");
>>>                     return -ENOMEM;
>>> +           }
>>>             vm_flags |= VM_ACCOUNT;
>>>     }
>>>  
>>> @@ -1278,6 +1288,7 @@ munmap_back:
>>>      */
>>>     vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
>>>     if (!vma) {
>>> +           printk("DEBUG kmem_cache_zalloc ENOMEM\n");
>>>             error = -ENOMEM;
>>>             goto unacct_error;
>>>     }
>> 
>> 
> 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel