Bill Allombert on Mon, 03 Apr 2017 21:36:44 +0200


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

Re: When enlarging stack in new_chunk_resize(), add 1/8 to stack size


On Mon, Apr 03, 2017 at 03:27:57PM +0200, Jeroen Demeyer wrote:
> This patch improves the implementation of new_chunk_resize(): it ensures
> that some stack space remains after calling new_chunk() and increasing the
> stack size. With the old code, after the stack was enlarged, one could
> immediately get a stack overflow.

Hello Jeroen, is it intended that the stack is only ever increased by
1/8 and not doubled anymore ?
I tried 
? polmodular(101);
  *** _polmodular_worker: Warning: increasing stack size to 9000918.
  *** _polmodular_worker: Warning: increasing stack size to 10126887.
  *** _polmodular_worker: Warning: increasing stack size to 11393413.
  *** _polmodular_worker: Warning: increasing stack size to 12818282.
  *** _polmodular_worker: Warning: increasing stack size to 14421071.
  *** _polmodular_worker: Warning: increasing stack size to 16224415.
  *** _polmodular_worker: Warning: increasing stack size to 18252556.
  *** _polint_worker: Warning: increasing stack size to 20534854.
  *** _polint_worker: Warning: increasing stack size to 23101953.
  *** _polint_worker: Warning: increasing stack size to 25989778.

This increases the risk the random gc run in a tight loop.

Could you align the stack size on page boundary ? This would avoid
waisting part of the last page.

Maybe explain with word what behaviour you want to implement.
Initially, I understand you wanted to avoid doubling the stack twice in
a row. But your patches has the effect to require more stack increase in
general.

Cheers,
Bill.