On Fri, Oct 07, 2016 at 11:47:17AM -0400, Ted Unangst wrote:
> Raimo Niskanen wrote:
> > And the manual page is wrong in claiming that ulimit -m takes effect when
> > the system gets low on memory?
> >
> > So the only memory limit that is enforced is ulimit -d?
>
> yeah. i'll fix the manual. thanks for noticing.
>
> > Bummer.
> >
> > What I guess we (VM tricksters) would really want is MAP_NORESERVE...
>
> that's not very hard to add. uvm has a concept of maxprot, which is the
> maximum protections one can add to a page. userland doesn't really get any
> control over this however. there could be a flag that leaves maxprot as none,
> and then we wouldn't need to count that as memory.
That would be super!
We (Erlang VM) currently tries use MAP_NORESERVE (and PROT_NONE) to
allocate a big address range and later remap some of it as PROT_READ |
PROT_WRITE when memory is needed. The address range is used to be able to
quickly identify which kind of memory it is.
The current situation when MAP_NORESERVE is defined but ignored is
confusing and I hoped that PROT_NONE would be enough to make it behave as
MAP_NORESERVE, but to make MAP_NORESERVE work as intended would be much
better!
A big thanks if MAP_NORESERVE should get implemented!
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB