Subject: Re: Replacement for grep(1) (part 2)
To: Brian F. Feldman <green@FreeBSD.org>
From: Noriyuki Soda <soda@sra.co.jp>
List: tech-userlevel
Date: 07/13/1999 23:28:21
>>>>> On Tue, 13 Jul 1999 10:11:14 -0400 (EDT),
"Brian F. Feldman" <green@FreeBSD.org> said:
>> > you also have to consider a program wishing to make sparse use
>> > of its address space, without overcommit it becomes impossible.
>>
>> SVR4 has MAP_NORESERVE option for mmap(2) for this.
>> So, default behaivour don't have to be overcommitment.
> Isn't that just like mmap()ing then mlock()ing the range? That would
> keep it in core.
No.
MAP_NORESERVE is nothing related to page wiring (i.e. mlock()ing).
From Solaris 2.6 man page:
: The MAP_NORESERVE option specifies that no swap space be
: reserved for a mapping. Without this flag, the creation of
: a writable MAP_PRIVATE mapping reserves swap space equal to
: the size of the mapping; when the mapping is written into,
: the reserved space is employed to hold private copies of the
: data. A write into a MAP_NORESERVE mapping produces results
: which depend on the current availability of swap space in
: the system. If space is available, the write succeeds and a
: private copy of the written page is created; if space is not
: available, the write fails and a SIGBUS or SIGSEGV signal is
: delivered to the writing process. MAP_NORESERVE mappings are
: inherited across fork(); at the time of the fork(), swap
: space is reserved in the child for all private pages that
: currently exist in the parent; thereafter the child's map-
: ping behaves as described above.
--
soda