RFR: 8013398: Adjust number of stack guard pages on systems with large memory page size

Vladimir Danushevsky vladimir.danushevsky at oracle.com
Mon Apr 29 08:38:10 PDT 2013

Hi Volker,

Thanks for the suggestion.

If I understand your approach correctly you suggest providing a dual way to specify guard area sizes (ether through number of pages or through an absolute size in KB) and have the VM to correlate between the two: Size value will dominate unless explicitly overwritten by the Page value.
Is that correct?

Will your approach eventually get same amount of allocated guard area as the patch suggested earlier would?
If an intent is to make the adjustments global (i.e. independent of the OS) should we copy those to the arguments.cpp instead of os_<OS name>.cpp?However  I'm not positive whether Windows, as an example, does need a guard area adjustment (but I might be wrong here).

Please post the webrev with the approach you suggested. It should be viewed as an alternative.


On Apr 29, 2013, at 11:03 AM, Volker Simonis wrote:

> Hi Vlad,
> thanks for addressing this issue. We have this problem as well since
> long time and we would like to propose a more general solution:
> Introduce three new platform dependant product flags:
> StackYellowSize
> StackRedSize
> StackShadowSize
> which are to be used to specify the concrete size of the corresponding
> stack regions. These sizes would be rounded up to the next multiple of
> the current OS page size (or more precisely the next multiple of the
> current OS stack page size, because there are systems which have
> different page sizes for stacks than for heap).
> This would allow us to make simple, (i.e. not platform dependent)
> product flags out of:
> StackYellowPages
> StackRedPages
> StackShadowPages
> and set their default value to -1.
> At VM start-up, before argument parsing, we will compute the values
> for StackYellowPages, StackRedPages, StackShadowPages from
> StackYellowSize, StackRedSize, StackShadowSize and the actual OS page
> size. Later on, during argument parsing, if one of these flags is
> given on the command line, either part of these value pairs may be
> adjusted in order to be consistent with its counterpart.
> The drawback of this approach is that you get three more options but
> from our point of view this is outweighed by the fact that with this
> approach you 'fix' all the places where you currently waste a lot of
> memory if the VM is running on a system with a default page size
> bigger than 4K.
> Notice that we use this approach since years in our commercial VM and
> only haven't integrated it into our OpenJDK PowerPC/AIX Port because
> we wanted to minimize the amount of shared code changes. We would be
> happy however to contribute it now that the discussion on this problem
> has popped up publicly on the mailing list. So if you agree, I could
> post a webrev with the proposed changes.
> Regards,
> Volker
> On Sat, Apr 27, 2013 at 2:34 AM, Vladimir Danushevsky
> <vladimir.danushevsky at oracle.com> wrote:
>> Please review the following change:
>> http://cr.openjdk.java.net/~vladidan/8013398/webrev.00/
>> for
>> https://jbs.oracle.com/bugs/browse/JDK-8013398
>> On a non-typical Linux system configuration with large page size (e.g. 64KB) significant amount of virtual memory is wasted to multiple guard pages when in fact that can be reduced to a single page per Red/Yellow/Shadow categories.
>> In some edge cases a minimal stack requirement is calculated higher than actual stack size specified by ThreadStackSize parameter causing VM to abort unless stack size is overwritten via -Xss option.
>> A patch currently being suggested adjusts amount of guard pages to a single memory page each along with minimal stack size when memory page size exceed 8KB unless explicitly overwritten in command line.
>> Currently we are aware of the problem on some Linux platforms, therefore the change is specific to that OS only (Solaris carries a similar approach already).
>> Shall the description string of StackRedPage, StackYellowPages and StackShadow pages be modified to reflect the values could be scaled down? If so the comment needs to indicate the change affects Linux and Solaris only. Any comments welcome here.
>> Thanks,
>> Vlad

More information about the hotspot-dev mailing list