Re: max mmap size for MAP_ANONYMOUS for amd64 ubuntu jaunty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried your mmap code on a 64bit machine, I am able to do much more
mmaps  than you said (around 8k such mmaps).
Please check /proc/<your process pid>/maps to see if you have enough
address space available.

-Vinit

On Mon, Sep 21, 2009 at 11:11 AM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> On Sun, Sep 20, 2009 at 6:08 PM, Mark Farnell <mark.farnell@xxxxxxxxx> wrote:
>> Hi!
>>
>> I tried to mmap 16GB of memory (MAP_ANONYMOUS) for my program which
>> runs on amd64 ubuntu jaunty.  However as long as I mmap more that 8GB,
>> it fails with ENOMEM
>>
>> if ((buf = mmap(NULL, (size_t)1024 * 1024 * 1024 * 16, PROT_READ | PROT_WRITE,
>>                  MAP_SHARED | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) {
>>    perror("mmap()");
>>    abort();
>>  }
>>
>> The machine happens to have 4GB of physical memory installed
>>
>> but ulimit shows no limit on max memory:
>
> Not sure about the MAP_ANONYMOUS limit, but from my own little
> experience in x86 32 bit, it might be due to mmap is unable to find
> your requested length of process address space.
>
> When you request 16 GB of VMA, it means you ask kernel to create a VMA
> that long on your user address space and it must be unpartitioned. In
> other word, it is a single 16 GB VMA, not 4 times 4 GB VMA, or 8 times
> 2 GB VMA and so on.
>
> The question is, is it available in your case? Try to check
> /proc/<your process pid>/maps to find out by yourself
>
> NB: Please note that we're talking about address space, not the
> availability of free pages.
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer
> blog: the-hydra.blogspot.com
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux