From: "Jan Beulich" <JBeulich@novell.com>
To: Charles Arnold <CARNOLD@novell.com>
Cc: xen-devel@lists.xensource.com, stefano.stabellini@eu.citrix.com
Subject: Re: Xen 4.0.1 "xc_map_foreign_batch: mmap failed: Cannot allocate memory"
Date: Fri, 07 Jan 2011 09:35:05 +0000 [thread overview]
Message-ID: <4D26EC59020000780002AF40@vpn.id2.novell.com> (raw)
>>> 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:
> 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;
>>> }
>>
>>
>
next reply other threads:[~2011-01-07 9:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-07 9:35 Jan Beulich [this message]
2011-01-07 11:18 ` Xen 4.0.1 "xc_map_foreign_batch: mmap failed: Cannot allocate memory" Stefano Stabellini
2011-01-07 12:37 ` Jan Beulich
2011-01-10 11:11 ` Stefano Stabellini
2011-01-07 17:03 ` Charles Arnold
-- strict thread matches above, loose matches on Subject: below --
2011-01-06 20:49 Charles Arnold
2011-01-05 18:10 Jan Beulich
2010-12-16 19:23 Charles Arnold
2010-12-16 20:33 ` Keir Fraser
2010-12-16 20:44 ` Charles Arnold
2010-12-16 20:54 ` Keir Fraser
2010-12-17 9:22 ` Jan Beulich
2010-12-17 10:06 ` Keir Fraser
2011-01-05 14:37 ` Stefano Stabellini
2011-01-05 15:30 ` Jan Beulich
2011-01-05 16:22 ` Stefano Stabellini
2011-01-05 16:33 ` Jan Beulich
2011-01-05 17:48 ` Stefano Stabellini
2011-01-05 18:09 ` Jan Beulich
2011-01-05 17:17 ` Charles Arnold
2011-01-06 16:50 ` Stefano Stabellini
2011-01-06 17:14 ` Charles Arnold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D26EC59020000780002AF40@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=CARNOLD@novell.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).