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

Re: [LTP] mmap001 questions



On Fri, Mar 09, 2001 at 11:06:28AM -0600, Robert Williamson wrote:
> I have a question about the "-m" option for mmap001.  I have a Linux box
> with 380MB ram installed.  I usually have about 355 to 360 MB of free
> memory (389 when swap space is included)....according to "free -m -t".  I'm

That doesn't sound like that much swap space, but that's beside the
point.

> trying to push the limits of the memory and get the manager to start using
> the swap space, so I specify enough calculated pages to go over the 355

What else do you have running besides the tests?  I believe you need
something that can be swapped out.  

> limit.  By running "top", I able to watch the memory usage increase during
> the test.  The problem is that memory usage always stops at the 355

As Aaron has told me, don't always trust top.  I ran the 2G mmap001 test
on my workstation (128M, 128M swap) and top said it only uses ~90MB.  If
you look in /proc/<mmap001 pid>/status you'll see that the virtual size
is 2G, which is correct. 

> limit....no matter what I put in the "-m" option.  I even went as far as
> specifing 2GB of memory and the test "PASSED" on all parts.  My question is
> on the validity of the test, since I'm able to set a memory limit of 2GB on
> a machine with only 380MB and get "PASS" on every case.

mmap maps a file (usually large) into memory.  When it's time to swap,
would you write those mmapped pages to swap space or back to the file?
mmap001 isn't going to use swap space.  You need something else running
that has allocated a lot of memory without using mmap.  

> I've just finished porting a similar test that uses mmap to write and then
> reads what was written and compares the data using a checksum.  Using this

Sounds like a great test!  I can't wait to see it.

> test I'm able to push the memory to the limit of crashing the box, but if I
> specify more memory than I actually have the appropriate "Cannot allocate
> memory" message occurs and the test is aborted.  I've compared my test to

Which syscall reports this?  

> mmap001, and the only major differences are that I use the PROT_WRITE and
> PROT_READ options on mmap, actually read from the written array for
> verification, and don't perform the msync.  I'm not trying to "beat up" on
> the mmap001 test....it's good and I've been using it to help my debugging

All tests should get "beat up" once in a while.  We want the tough test
cases that survive the beatings. :)

> efforts on my ported testcase....I'm just trying to understand the "hidden"
> protection within the mmap001 test.

I don't think there is anything "hidden" in mmap001.  I think you might
be learning something about how mmap works.  

-- 
Nate Straz                                              nstraz@sgi.com
sgi, inc                                           http://www.sgi.com/
Linux Test Project                    http://oss.sgi.com/projects/ltp/