| To: | "linux-mips@linux-mips.org" <linux-mips@linux-mips.org> |
|---|---|
| Subject: | RE: patch to support topdown mmap allocation in MIPS |
| From: | "Jian Peng" <jipeng@broadcom.com> |
| Date: | Mon, 16 May 2011 16:37:22 -0700 |
| Accept-language: | en-US |
| Acceptlanguage: | en-US |
| Cc: | "Ralf Baechle" <ralf@linux-mips.org> |
| In-reply-to: | <E18F441196CA634DB8E1F1C56A50A8743242B54C8A@IRVEXCHCCR01.corp.ad.broadcom.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <E18F441196CA634DB8E1F1C56A50A8743242B54C8A@IRVEXCHCCR01.corp.ad.broadcom.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
| Thread-index: | AcwUDZV1rkskQxMpROqms+cuQJj71wAFAjmg |
| Thread-topic: | patch to support topdown mmap allocation in MIPS |
Here is my testing program that intentionally caused OOM by calling mmap() to
allocate 8MB each time.
Without patch, it failed at 168th mmap call, and with patch, it failed at 254th
mmap call. It is 688MB more usable virtual address space.
/*
* A simple testing program to cause OOM by calling mmap()
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
void *test_mmap(unsigned long addr, unsigned long size)
{
void *pMem;
pMem = (char *)mmap((void *)addr, size, PROT_NONE, MAP_PRIVATE |
MAP_ANONYMOUS, -1, 0);
printf("%s:addr=0x%08x, size=0x%x, return 0x%08x\n", __FUNCTION__,
addr, size, pMem);
if (MAP_FAILED == pMem)
{
printf("test_mmap FAILED\n");
pMem = NULL;
}
return pMem;
}
int main(int argc, char **argv)
{
int done = 0;
int keep = 1;
while(keep)
{
int i;
int loops = 2000000000;
if(!done) {
for(i=0; i<loops; i++)
if(test_mmap(0, 0x800000) == NULL)
{
printf("\t\tFAILED at %d try\n", i);
break;
}
done = 1;
}
sleep(1);
}
}
-----Original Message-----
From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Jian Peng
Sent: Monday, May 16, 2011 2:10 PM
To: linux-mips@linux-mips.org
Cc: Ralf Baechle
Subject: patch to support topdown mmap allocation in MIPS
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | patch to support topdown mmap allocation in MIPS, Jian Peng |
|---|---|
| Next by Date: | Re: patch to support topdown mmap allocation in MIPS, David Daney |
| Previous by Thread: | patch to support topdown mmap allocation in MIPS, Jian Peng |
| Next by Thread: | Re: patch to support topdown mmap allocation in MIPS, David Daney |
| Indexes: | [Date] [Thread] [Top] [All Lists] |