Bill Allombert on Thu, 29 Sep 2016 17:47:02 +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.

Hello Jeroen,

thanks for your patch.

Do you have some framework to test this ?

> 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.

Do you have some relevant documentation for this behaviour ?

> 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.

It is unclear from the documentation of mprotect that it can actually
fail for that reason. Can you make it fail and what is the error code ?

It remains the last point which is: is it the behaviour users of
vm.overcommit = 2 and parisizemax want, or would they prefer the stack
to be fully available up to parisizemax.

Cheers,
Bill.