From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: Xen 4.0.1 "xc_map_foreign_batch: mmap failed: Cannot allocate memory" Date: Fri, 07 Jan 2011 09:35:05 +0000 Message-ID: <4D26EC59020000780002AF40@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Charles Arnold Cc: xen-devel@lists.xensource.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 06.01.11 at 21:49, Charles Arnold wrote: > >>> On 1/6/2011 at 10:14 AM, in message <4D25C782.5B74.0091.0@novell.com>= , Charles Arnold wrote:=20 > 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//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 >=20 >>> --- >>>=20 >>>=20 >>>=20 >>> 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=20 >=20 >>=20 >>> long addr, >>> =20 >>> /* Careful about overflows.. */ >>> len =3D PAGE_ALIGN(len); >>> - if (!len) >>> + if (!len) { >>> + printk("DEBUG PAGE_ALIGN ENOMEM\n"); >>> return -ENOMEM; >>> + } >>> =20 >>> /* offset overflow? */ >>> if ((pgoff + (len >> PAGE_SHIFT)) < pgoff) >>> return -EOVERFLOW; >>> =20 >>> /* 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; >>> + } >>> =20 >>> /* 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=20 >=20 >>=20 >>> long addr, >>> munmap_back: >>> vma =3D 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; >>> } >>> =20 >>> /* 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; >>> + } >>> =20 >>> /* >>> * Set 'VM_NORESERVE' if we should not account for the >>> @@ -1259,8 +1267,10 @@ munmap_back: >>> */ >>> if (accountable_mapping(file, vm_flags)) { >>> charged =3D 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 |=3D VM_ACCOUNT; >>> } >>> =20 >>> @@ -1278,6 +1288,7 @@ munmap_back: >>> */ >>> vma =3D kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); >>> if (!vma) { >>> + printk("DEBUG kmem_cache_zalloc ENOMEM\n"); >>> error =3D -ENOMEM; >>> goto unacct_error; >>> } >>=20 >>=20 >=20