Jeroen Demeyer on Mon, 03 Oct 2016 22:10:28 +0200

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

Re: Use PROT_NONE for unused virtual stack memory

On 2016-10-03 20:21, Bill Allombert wrote:
No. As far as I know, this is undocumented.

This is problematic... I wrote this code following the POSIX standard.
The code is not meant to be linux specific.

As far as I know, POSIX does not define things like overcommitting memory, so it couldn't be in the POSIX standard. But as you say, the new code is still POSIX-compliant.

Did you try madvise(, MADV_DONTNEED) ?

Yes and it did not help. I also tried it in combination with mprotect(..., PROT_NONE) and it still did not behave the same as remapping with PROT_NONE.

But your patch remove MAP_NORESERVE. Why ?

Because it is no longer needed: with my patch, all memory on the PARI stack is either really used (the actual PARI stack) or not committed (the virtual stack between vbot and bot, mapped with PROT_NONE). In both of these cases, the MAP_NORESERVE flag makes no difference.