Bill Allombert on Sun, 22 Jan 2017 12:12:53 +0100


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

Re: Use PROT_NONE for unused virtual stack memory


On Thu, Jan 19, 2017 at 11:41:38PM +0000, Jeroen Demeyer wrote:
> On 2017-01-19 13:58, Bill Allombert wrote:
> >On Thu, Jan 19, 2017 at 12:27:09PM +0000, Jeroen Demeyer wrote:
> >>On 2017-01-19 11:54, Bill Allombert wrote:
> >>>This leads to a change of behaviour. Is it intended ?
> >>
> >>Yes, this is due to changes in new_chunk_resize(). Instead of iteratively
> >>doubling, the PARI stack is increased by more than a factor 2 if needed.
> >
> >The decision about how much to enlarge the stack should be left to
> >paristack_resize(0) and not be hard-coded in new_chunk_resize.
> >This way it is possible to implement other policies in
> >paristack_resize(0).
> 
> It just seemed inefficient to call paristack_resize(0) multiple times
> compared to calling it once with a large stack value. Honestly, I think it's
> an irrelevant detail and I don't really care about it.

One issue with this policy is that much of the time, the next call to
new_chunk will also overflow the stack so this is not really more
efficient.
It also increases the possibility that the gc_needed mechanism enter a
tight loop.

Cheers,
Bill.