Subject: Re: Swap overcommit (was Re: Replacement for grep(1) (part 2))
To: D. Rock <>
From: Matthew Dillon <>
List: tech-userlevel
Date: 07/15/1999 15:37:31
:Before program start:
:total: 20000k bytes allocated + 4792k reserved = 24792k used, 191048k available
:After malloc, before touch:
:total: 18756k bytes allocated + 37500k reserved = 56256k used, 159580k available
:After malloc + touch:
:total: 52804k bytes allocated + 4852k reserved = 57656k used, 158184k available
:After fork:
:total: 52928k bytes allocated + 37644k reserved = 90572k used, 125264k available
:[there has been a little background activity, but the numbers speak for themselves]

    Assuming the allocated field is not inclusive of real
    memory, what we have is swap reservation under solaris
    for clean pages, and allocation and assignment for dirty
    pages.  The grand total will tell you the total VM potential
    for malloc'd space but does not appear to tell you how 
    much swap is actually active - i.e. was written to and 
    contains valid data.

    It would be interesting to see if the stack segment is
    included in the reservation.  Try setting the stack resource
    limit to 32m and run the same program, except without
    bothering to malloc() or touch anything.  See if the
    stack segment is included in the reservation field.

    It would also be interesting to see how solaris deals
    with MAP_PRIVATE mmap's.

    If this is correct, then solaris is using a VMSPACE = SWAPSPACE
    model.  FreeBSD uses a VMSPACE = SWAPSPACE + REALMEM model.

					Matthew Dillon