Subject: Redefining MAXDSIZ / RLIMIT_DATA
To: None <tech-kern@NetBSD.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 12/15/2003 11:07:23
The notion of a process being split into a text section, a data section 
(+ bss),
and a stack section is mostly outdated.  Except for the use of brk/sbrk,
nothing really cares these distinctions.

I propose redefining MAXDSIZ and RLIMIT_DATA from being the size of a
program data section to the number of bytes in pages backed by anonymous
storage (aka swap).  This redefinition will allow limitations on the 
amount
mmap'ed anonymous pages (which currently has no limitations).

A process will still have text, data, and stack sections for 
compatibility
but, other than brk/sbrk, nothing will care.

As for accounting, there are 4 cases when a page could be considered 
using
"swap":

1) when copy-on-write (or demand-zeroed) but not yet faulted.
2) when copy-on-write (or demand-zeroed) and read-faulted.
3) when first write-faulted.
4) when actually needing to allocate a swap location

The first case is useful on when you want to prevent over-commitments on
the amount of swap.  The others are just various methods of 
overcommitment.

Comments?
-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this 
message.