buggy mlock() behaviour in 2.6.9 on ppc64?
Chris Friesen
cfriesen at nortel.com
Thu Feb 3 06:01:33 EST 2005
Olof Johansson wrote:
> On Wed, Feb 02, 2005 at 12:11:22PM -0600, Chris Friesen wrote:
>>I've got a simple test app that tries to mmap() and mlock() an amount of
>>memory specified on the commandline.
>>With the ppc64 kernel, however, the system hangs, and the fans speed
>>starts increasing. It seems like it doesn't realize that there is
>>simply no way that it will ever be able to succeed.
>>
>>Is this expected behaviour for ppc64?
> linuxppc64-dev at ozlabs.org is the ppc64 mailing list, you might want to
> Cc: there instead for the ppc64 questions.
Ah, right. I'm copying the list if anyone else wants to take a look.
> Anyhow, can you send me the testcase? Sounds like you're running on a
> G5, it's easier to debug on a pSeries where we have debugger console.
> Unless you have a stealth card in the machine?
Yes, I am on a G5 and I don't have a stealth card.
Here's the testcase. I've got 2gig of physical memory.
"chewtest 1 1000000" gives an error that it can't allocate memory
"chewtest 1 500000" gets killed by the oom killer
"chewtest 1000 1000" just sits there
Chris
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
int main(int argc, char **argv)
{
if (argc != 3) {
printf("usage: %s <mappings> <pages per mapping>\n", *argv);
return -1;
}
int mappings = atoi(argv[1]);
int ppm = atoi(argv[2]);
int mapsize = sysconf(_SC_PAGESIZE)*ppm;
int i;
int rc;
void *buf;
for (i=0;i<mappings;i++) {
buf = (char *) mmap(0, mapsize, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
if (buf == MAP_FAILED) {
perror("unable to get memory");
return -1;
}
rc = mlock(buf, mapsize);
if (rc<0) {
perror("unable to lock memory");
return -1;
}
}
return 0;
}
More information about the Linuxppc64-dev
mailing list