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

Volker Simonis volker.simonis at gmail.com
Mon Apr 29 08:03:45 PDT 2013

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:


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:


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.


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