Subject: Re: new mremap(2): relax alignment restrictions?
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 07/30/2007 12:01:52
> There are four possible approaches to this problem:

> (1) Discontinue [UBC].
> (2) Zero the page at random times (e.g. scheduling).
> (3) Trap on write.
> (4) Disallow mmap for write on not page-sized files.

You promptly mention (5) ignore the issue, so "four" is a bit wrong.

There's actually another one you failed to mention: (6) Zero the page
at predictable times.  In particular, I don't *like* sharing the rest
of the page amonjg multiple simultaneous mappers, but I can deal with
it - but I really think it's a bug that the rest of the page is shared
across time, between past mappers and current mappers.  I think the
rest of the page should be cleared at two times: (a) when the file is
extended (ie, the truncate(2) issue mentioned upthread) and (b) when
nobody has it mapped.  (b) could be implemented as "clear on last
unmap" or "clear on first map"; I'd prefer the former, but it's a
relatively mild preference.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B