Bill Allombert on Sat, 24 Sep 2016 11:38:29 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Use PROT_NONE for unused virtual stack memory


On Sat, Sep 24, 2016 at 08:33:28AM +0200, Jeroen Demeyer wrote:
> Hello pari-dev,
> 
> In attachment you find a patch to change the way how stack memory is
> allocated with mmap(). It is meant to improve support for Linux with
> vm.overcommit = 2 [1] and still allow a reasonably large parisizemax in that
> case.
> 
> The idea is to use PROT_NONE for the unused part of the PARI stack (between
> vbot and bot). Memory mmap()ed with PROT_NONE is not committed: it does not
> count against the available physical/swap memory available for the system.
> 
> One consequence of this patch is that increasing the actual size (during
> some calculation which needs more stack space) can fail. This is not a
> problem since we can handle this failure the same way that we handle a usual
> PARI stack overflow.
> 
> Otherwise, this does not functionally affect PARI.

Thanks for your patch. Did you test this on OS X as well ?

Cheers,
Bill.